美文网首页
独立性检验在R中的实现

独立性检验在R中的实现

作者: 鼠小标 | 来源:发表于2018-04-06 16:41 被阅读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值判断变量之间是否存在独立。

相关文章

网友评论

      本文标题:独立性检验在R中的实现

      本文链接:https://www.haomeiwen.com/subject/oojshftx.html