这是在 R 中。我需要帮助获取基本格式的数据框
NAC cOF3 APir Pu Tu V2.3 mOF3 DGpf
1 6.314770 6.181188 6.708971 6.052134 6.546938 6.079848 6.640716 6.263770
2 8.825595 8.740217 9.532026 8.919598 8.776969 8.843287 8.631505 9.053732
3 5.518933 5.982044 5.632379 5.712680 5.655525 5.580141 5.750969 6.119935
4 6.063098 6.700194 6.255736 5.124315 6.133631 5.891009 6.070467 6.062815
5 8.931570 9.048621 9.258875 8.681762 8.680993 9.040971 8.785271 9.122226
6 5.694149 5.356218 5.608698 5.894171 5.629965 5.759247 5.929289 6.092337
并简化对每列与所有其他列组合进行 t 检验的任务。我还需要 p 值,我计划通过一些变化来获得:
#t-test
test.result = mapply(t.test, select.column, other.columns)
#store p-values
p.values = stack(mapply(function(x, y) t.test(x,y)$p.value, select.column, other.columns))
或者 aov() 是否是此类分析的更好替代方案?
sapply(names(dat), function(x)
sapply( names(dat), function(y) t.test(dat[[x]],dat[[y]])$statistic ))
可以使用函数 t.test 列表中返回的任何值。也可以循环遍历结果combn(names(dat), 2)
,这将是一个choose(n,2)
矩阵。 (方阵有明显的冗余结果)显然需要对多次测试进行合理的调整。可以用p.adjust
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)