Examples for 'stats::mcnemar.test'


McNemar's Chi-squared Test for Count Data

Aliases: mcnemar.test

Keywords: htest

### ** Examples

## 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 voting-age Americans.
Performance <-
matrix(c(794, 86, 150, 570),
       nrow = 2,
       dimnames = list("1st Survey" = c("Approve", "Disapprove"),
                       "2nd Survey" = c("Approve", "Disapprove")))
Performance
            2nd Survey
1st Survey   Approve Disapprove
  Approve        794        150
  Disapprove      86        570
mcnemar.test(Performance)
	McNemar's Chi-squared test with continuity correction

data:  Performance
McNemar's chi-squared = 16.818, df = 1, p-value = 4.115e-05
## => significant change (in fact, drop) in approval ratings

[Package stats version 4.2.3 Index]