mcnemar(table, exact=True, correction=True)¶
McNemar test of homogeneity.
A square contingency table.
If exact is true, then the binomial distribution will be used. If exact is false, then the chisquare distribution will be used, which is the approximation to the distribution of the test statistic for large sample sizes.
If true, then a continuity correction is used for the chisquare distribution (if exact is false.)
The test statistic is the chisquare statistic if exact is false. If the exact binomial distribution is used, then this contains the min(n1, n2), where n1, n2 are cases that are zero in one sample but one in the other sample.
p-value of the null hypothesis of equal marginal distributions.
This is a special case of Cochran’s Q test, and of the homogeneity test. The results when the chisquare distribution is used are identical, except for continuity correction.