statsmodels.sandbox.stats.runs.mcnemar¶
-
statsmodels.sandbox.stats.runs.
mcnemar
(x, y=None, exact=True, correction=True)[source]¶ McNemar test
- Parameters
- x, yarray_like
two paired data samples. If y is None, then x can be a 2 by 2 contingency table. x and y can have more than one dimension, then the results are calculated under the assumption that axis zero contains the observation for the samples.
- exactbool
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.
- correctionbool
If true, then a continuity correction is used for the chisquare distribution (if exact is false.)
- Returns
- stat
float
orint
,array
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.
- pvalue
float
orarray
p-value of the null hypothesis of equal effects.
- stat
Notes
This is a special case of Cochran’s Q test. The results when the chisquare distribution is used are identical, except for continuity correction.