How to derive sampling variance of paired differences？ I'm reading the paper (Mcnemar 1947), which introduces the origin of Mcnemar's test. And it gets me confused by understanding the equation of sampling variance of difference between proportional frequencies for paired data.
For example, suppose we have a $2\times 2$ contingency table





No
Yes





Yes
A
B
A+B


No
C
D
C+D



A+C
B+D
N




The corresponding proportional frequencies table is





No
Yes





Yes
a
b
$p_1$


No
c
d
$q_1$



$q_2$
$p_2$
1.00




Then the sampling error of $p_2-p_1$ is
$$
\sigma_{p_2-p_1}^2=\frac{1}{N^2}[N(D+A)-(D-A)^2]=(d+a)-(d-a)^2
$$
Could anyone explain how to derive this equation?

$\DeclareMathOperator{\Var}{Var}$
$\DeclareMathOperator{\Cov}{Cov}$
To derive the sampling distribution of any statistics, you need to specify the underlying distribution first.  For the paired data, although the paper you linked didn't make this clear, the joint distribution of the counts in four cells is probably a multinomial distribution, i.e., $(A, B, C, D) \sim M_4(N; \pi_{11}, \pi_{12}, \pi_{21}, \pi_{22})$. By properties of multinomial distribution, we have
\begin{align}
& \Var(A) = N\pi_{11}(1 - \pi_{11}), \\
& \Var(D) = N\pi_{22}(1 - \pi_{22}), \\
& \Cov(A, D) = -N\pi_{11}\pi_{22}. \tag{1}
\end{align}
It then follows by $(1)$ and $p_1 = (A + B)/N, p_2 = (B + D)/N$ that
\begin{align}
 & \operatorname{Var}(p_2 - p_1) = \Var(N^{-1}(D - A)) \\
=& N^{-2}(\Var(D) + \Var(A) - 2\Cov(A, D)) \\
=& N^{-2}(N\pi_{22}(1 - \pi_{22}) + N\pi_{11}(1 - \pi_{11}) + 2N\pi_{11}\pi_{22}) \\
=& \frac{1}{N^2}\left(N(\pi_{11} + \pi_{22}) - N(\pi_{11} - \pi_{22})^2\right) \\
=& \frac{1}{N}\left((\pi_{11} + \pi_{22}) - (\pi_{11} - \pi_{22})^2\right) \tag{2}
\end{align}
The standard error of $p_2 - p_1$, which I will denote it by $\hat{\sigma}^2_{p_2 - p_1}$ (the notation $\sigma^2_{p_2 - p_1}$ is not very accurate), can then be obtained by estimating $\pi_{11}$ and $\pi_{22}$ in $(2)$ by $\hat{\pi}_{11} = A/N$ and $\hat{\pi}_{22} = D/N$ respectively:
\begin{align}
\hat{\sigma}^2_{p_2 - p_1} = \frac{1}{N}\left(\left(\frac{A}{N} + \frac{D}{N}\right) - \left(\frac{A}{N} - \frac{D}{N}\right)^2\right) 
= \frac{1}{N}((d + a) - (d - a)^2). \tag{3}
\end{align}
$(3)$ differs from what you posted by a factor of $N$, which is probably due to that the paper used a different multinomial assumption on $(a, b, c, d) \sim M_4(1; \pi_{11}, \pi_{12}, \pi_{21}, \pi_{22})$ (but as you said, the manuscript did not clearly stated any assumptions or showed any derivation).  However, the essence should be the same (and for all similar statistical problems).  Note that, Categorical Data Analysis (Third Edition) by Alan Agresti, pp. 414 -- 415 presented the same result as $(3)$.
