准确的说,该类检验属于列联表数据的独立性检验,可用方法有Pearson 卡方检验、Fisher精确检验和McNemar检验,下面分别做:
x=c(7,24,89,122)
dim(x)=c(2,2)
方法一:
chisq.test(x,correct=F)
Pearson's Chi-squared test
data: x
X-squared = 4.3383, df = 1, p-value = 0.03726
结论:P值=0.03726小于0.05,拒绝原假设,认为系安全带与是否发生车祸有关。
方法二:
fisher.test(x)
Fisher's Exact Test for Count Data
data: x
p-value = 0.04838
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
0.1396341 1.0137455
sample estimates:
odds ratio
0.4012093
结论:P值=0.0.04838小于0.05,拒绝原假设,认为系安全带与是否发生车祸有关。
方法三:
mcnemar.test(x,correct=F)
McNemar's Chi-squared test
data: x
McNemar's chi-squared = 37.3894, df = 1, p-value = 9.675e-10
结论同上。
温馨提示:答案为网友推荐,仅供参考