我使用pairwise.t.test命令,我有以下变量:
bestID = 28
> ptt <- pairwise.t.test(aovFrame$partAvg,aovFrame$id,p.adjust="bonf", conf.level = 0.95)
> ptt
Pairwise comparisons using t tests with pooled SD
data: aovFrame$partAvg and aovFrame$id
12 13 15 24 28 29
13 <2e-16 - - - - -
15 <2e-16 <2e-16 - - - -
24 <2e-16 <2e-16 <2e-16 - - -
28 <2e-16 <2e-16 <2e-16 <2e-16 - -
29 <2e-16 2e-16 <2e-16 <2e-16 <2e-16 -
30 <2e-16 <2e-16 1 <2e-16 <2e-16 <2e-16
P value adjustment method: bonferroni 使用bestID表示要与所有其他id比较的id(作为索引),并提取其p值。如果两个id之间的p值都< 0.05,那么我希望将该id(而不是28)添加到列表中。
您可以在代码中看到,28的所有对(按列和按行)都不类似于28。
问题是我不知道如何按索引访问paired.t.test字段
使用str(ptt)将输出以下内容:
List of 4
$ method : chr "t tests with pooled SD"
$ data.name : chr "aovFrame$partAvg and aovFrame$id"
$ p.value : num [1:6, 1:6] 2.12e-20 1.11e-154 0.00 7.24e-26 1.19e-66 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : chr [1:6] "13" "15" "24" "28" ...
.. ..$ : chr [1:6] "12" "13" "15" "24" ...
$ p.adjust.method: chr "bonferroni"
- attr(*, "class")= chr "pairwise.htest"从这里我无法理解如何访问索引
发布于 2015-12-06 16:12:59
要回答“我需要一种自动的方法从ptt中提取对应于bestID的p值”(请参阅OP上的注释线程):
ptt$p.value[as.character(bestID),]https://stackoverflow.com/questions/34118882
复制相似问题