在 R 中,该函数mcnemar.test具有以下示例:
## 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
mcnemar.test(Performance)
## => significant change (in fact, drop) in approval ratings
我想执行一个单方面的版本,例如,在上面的示例中,以测试批准是否下降。我找到了一个执行双面和单面测试的包(exact2x2)。
exact2x2(Performance, alternative="two.sided", conf.level=0.95, paired=T)
## vs.
exact2x2(Performance, alternative="greater", conf.level=0.95, paired=T)
我的统计问题是:
- 如何进行单面的 McNemar 检验?两者在数学上有什么区别?
另外,我想知道:
为什么基本 R 函数不提供单面测试选项,而大多数其他统计测试提供该选项?
为什么包功能的两侧测试结果不同?