独立性检验在R中的实现
2018-04-06 本文已影响0人
鼠小标
以下分析用到package vcd中的Arthritis数据集
library(vcd)
attach(Arthritis)
卡方检验(Chi-squrae test)
mytable <- xtabs(~Treatment+Improved, data = Arthritis)
chisq.test(mytable)
Fisher's exact test
fisher.test(mytable)
Cochran-Mantel-Haenszel test
mantelhaen.test(mytable)
根据生成的报告中的p值判断变量之间是否存在独立。