The same respondents report presidential approval a month apart. Approval drops from 59% to 55%. That determines the four-percentage-point change, but not the strength of evidence about its direction. Everyone who switched might have switched one way, or two large groups might have exchanged views. McNemar's test distinguishes those situations by pairing the two answers before comparing the opposite changes.[1][2]

Count the people who switched

Put the first response in rows and the second in columns, both ordered yes, no. The diagonal contains people who kept their answers. Let b denote yes to no and c no to yes. The second proportion minus the first equals (c−b)/n. The diagonal cancels from the numerator but the full sample remains in the denominator of the change. Agreement alone cannot say which way switchers went.[1][2]

Under marginal homogeneity the two transition probabilities are equal. Conditional on the total number of discordant pairs, either directional count follows a binomial distribution with success probability one half. Pairs must be independent across people; answers within a person can be correlated. Preserve the identifier linking the two responses. Two separate totals of positive responses cannot reconstruct the discordant counts.[1][2]

A four-point drop contains two opposing movements

In the Agresti example in R's documentation, 1,600 people were surveyed twice. Of 944 initial approvers, 794 still approved and 150 no longer did. Among initially disapproving respondents, 86 changed to approval and 570 maintained their answer. There were 880 approvers at follow-up. The directional comparison is 150 departing versus 86 arriving, not an independent comparison of 944 and 880 respondents.[1]

The uncorrected statistic is (b−c)²/(b+c), referred to a chi-squared distribution with one degree of freedom. For this table the continuity correction subtracts one from the absolute difference before squaring. The exact conditional test uses binomial tails. The mid-p method gives half weight to the observed boundary mass when forming the tail. Our two-sided values in this order are 0.0000310, 0.0000411, 0.0000372 and 0.0000289. The estimated change is identical and all four methods give similar evidence on this table.[1][2]

Four tests on two tables, with the 0.05 line marked

Figure: Two-sided tests for two paired tables.

Eight discordant pairs separate the four answers

Fagerland and colleagues examined airway hyperresponsiveness before and after transplantation. Among 21 children, one was positive twice, one changed to negative, seven became positive and twelve remained negative. The proportions rose from 2/21 to 8/21, about 28.6 percentage points. Directional evidence comes from one versus seven. For eight independent switches with equally probable directions, the lower tail for zero or one is 9/256. The two-sided exact probability is 18/256, or 0.0703.[2]

For the same observations, the uncorrected asymptotic value is 0.0339, the continuity-corrected value 0.0771 and the mid-p value 0.0391, matching the published example after rounding. An exact conditional test counts all the probability at the observed boundary, which is a large increment at this sample size. The correction is also consequential. Straddling 0.05 does not change the underlying one-to-seven comparison. A significance label alone hides both the transitions and the method.[2]

Report the change and the version together

Give both proportions, their absolute change and both discordant counts, then name the tail and method. R defaults to continuity correction for a two-by-two table. The statsmodels function defaults to an exact binomial calculation; setting exact to false brings the chi-squared and correction choices into play. Fagerland and colleagues found the exact conditional and corrected methods could be conservative and recommended mid-p as a practical option. If strict conditional error control is central to the design, address that trade-off in advance. Selecting a method after inspecting which one crosses a threshold changes the question.[1][2][3]

Equal margins can coexist with many switches in both directions or with nearly everyone retaining their original response. Agreement requires its own summary or measure. Independent groups and observations repeated more than twice have different structures. What the paired table preserves is the two-way traffic that separate marginal proportions cannot show.[1][2]

References

  1. [1] R Core Team. McNemar's Chi-squared Test for Count Data

  2. [2] Fagerland, Lydersen & Laake (2013). The McNemar test for binary matched-pairs data: mid-p and asymptotic are better than exact conditional

  3. [3] statsmodels. McNemar test of homogeneity