mcnemar.test
McNemar's Chisquared Test for Count Data
Performs McNemar's chisquared test for symmetry of rows and columns in a twodimensional contingency table.
 Keywords
 htest
Usage
mcnemar.test(x, y = NULL, correct = TRUE)
Arguments
 x
 either a twodimensional contingency table in matrix form, or a factor object.
 y
 a factor object; ignored if
x
is a matrix.  correct
 a logical indicating whether to apply continuity correction when computing the test statistic.
Details
The null is that the probabilities of being classified into cells
[i,j]
and [j,i]
are the same.
If x
is a matrix, it is taken as a twodimensional contingency
table, and hence its entries should be nonnegative integers.
Otherwise, both x
and y
must be vectors or factors of the
same length. Incomplete cases are removed, vectors are coerced into
factors, and the contingency table is computed from these.
Continuity correction is only used in the 2by2 case if
correct
is TRUE
.
Value

A list with class
 statistic
 the value of McNemar's statistic.
 parameter
 the degrees of freedom of the approximate chisquared distribution of the test statistic.
 p.value
 the pvalue of the test.
 method
 a character string indicating the type of test performed, and whether continuity correction was used.
 data.name
 a character string giving the name(s) of the data.
"htest"
containing the following components:
References
Alan Agresti (1990). Categorical data analysis. New York: Wiley. Pages 350354.
Examples
library(stats)
## Agresti (1990), p. 350.
## Presidential Approval Ratings.
## Approval of the President's performance in office in two surveys,
## one month apart, for a random sample of 1600 votingage Americans.
Performance <
matrix(c(794, 86, 150, 570),
nrow = 2,
dimnames = list("1st Survey" = c("Approve", "Disapprove"),
"2nd Survey" = c("Approve", "Disapprove")))
Performance
mcnemar.test(Performance)
## => significant change (in fact, drop) in approval ratings
Community examples
Looks like there are no examples yet.