Gün*_*nal 5 testing statistics r
我有如下分类数据:
gender age_group diagnosis
male young x
female child y
female adult x
male old z
gender, age_group and diagnosis have 2, 4 and 3 levels respectively.
Run Code Online (Sandbox Code Playgroud)
我想进行一个Chi-Squared Test查看两个类之间的关系。我怎么能在 R 中做到这一点
我认为,三维列联表的适当测试是Cochran-Mantel-Haenszel 测试。为了使用它,您需要将数据转换为三维数组,并确保stratum生成的列联表中每个可能的频率 > 1。
# convert data to contigency table
df <- table(data)
# run test
mantelhaen.test(df)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5542 次 |
| 最近记录: |