我在这里发现了一个类似的问题,但我认为我的问题是如果我正确解释我的数据。
我做了我的简单anova,发现在我的数据中我有一个显着的不同(p.value< 0.05:
an<-aov(Value ~ Group, data=mydata)
然后我做我的TukeyHSD:
TukeyHSD(an)
我的输出看起来像是:
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = Value ~ Group, data = kwdata)
diff lwr upr p adj
X-A -3.15668041 -8.0916672 1.7783064 0.6646288
C-A -2.07921381 -5.0632490 0.9048214 0.5209910
D-A 0.54997509 -1.8916800 2.9916302 0.9999804
w-X 3.79964159 -3.6284972 11.2277804 0.9108728
D-C 2.62918890 -0.5801339 5.8385117 0.2473717
如果我正确地解释它,我的组与超过0.0的lwr值的组合是具有最高显着差异的组。这是对的吗?
我不确定如何检测出与tukeyhsd有显着差异的群体。
此输出仅与实际输出相距几行。我的任务是分析多组并检测具有显着差异的组。
编辑:
现在是一个完整的例子:
Value<- c(-0.9944999814033508,-0.35850000381469727,0.7063000202178955,-1.774399995803833,-1.080299973487854,0.30550000071525574,1.8499999046325684,-0.4124999940395355,0.5827999711036682,1.7506999969482422,-6.693999767303467,-0.8779000043869019,-1.3408000469207764,1.2560999393463135,-0.10040000081062317,1.8499999046325684,-0.3319000005722046,0.4957999885082245,0.8779000043869019,0.7387999892234802,0.8779000043869019,0.9154000282287598,0.8779000043869019,0.7063000202178955,-1.3408000469207764,0.7063000202178955,-0.3319000005722046,-1.6448999643325806,0.4124999940395355,-1.6448999643325806,-0.8779000043869019,0.7487000226974487,0.4399000108242035,1.8499999046325684,-1.6448999643325806,-2.4323999881744385,1.2265000343322754,-0.4957999885082245,-9.999899864196777,-1.7506999969482422,-1.6448999643325806,-9.999899864196777,0.8779000043869019,-5.06279993057251,0.8779000043869019,-2.9677000045776367,-5.06279993057251,-6.693999767303467,-1.0990500450134277,0.9944999814033508,-0.4677000045776367,-0.35850000381469727,-9.999899864196777,0.5827999711036682,0.7487000226974487,0.7387999892234802,-0.2533000111579895,-9.999899864196777,-1.0363999605178833,0.30550000071525574,-1.1749999523162842,-0.8064000010490417,-9.999899864196777,-0.9944999814033508,-2.478300094604492,-0.1509999930858612,0.4957999885082245,-4.571800231933594,-6.324900150299072,-0.38530001044273376,-1.3408000469207764,-5.93179988861084,-6.693999767303467,-2.9677000045776367,0.8779000043869019,-0.050200000405311584,-1.774399995803833,-0.1509999930858612,-0.23725003004074097,-0.6432999968528748,1.2560999393463135,-0.10040000081062317,0.4399000108242035,-0.7063000202178955,0.9154000282287598,-0.21819999814033508,1.2265000343322754,-0.4124999940395355,0.17640000581741333,-1.4758000373840332,-0.9944999814033508,-1.080299973487854,-0.6432999968528748,-9.999899864196777,-2.0536999702453613,-0.21819999814033508,0.7487000226974487,0.025100000202655792,-1.0363999605178833,-0.050200000405311584,-0.7387999892234802,0.4957999885082245,-1.4758000373840332,-0.7063000202178955,0.17640000581741333,-5.06279993057251,-0.6432999968528748,-1.4758000373840332,-0.9944999814033508,-0.2533000111579895,0.17640000581741333,-0.3319000005722046,0.6776500344276428,0.30550000071525574,-0.050200000405311584,0.5827999711036682,1.2560999393463135,-0.4957999885082245,-0.38530001044273376,0.9944999814033508,-2.4323999881744385,1.1263999938964844,-0.9944999814033508,1.7506999969482422,1.080299973487854,-0.7387999892234802,-1.3408000469207764,0.6128000020980835,-2.0536999702453613,0.7063000202178955,-0.8064000010490417,-0.8779000043869019,-0.050200000405311584,-2.9677000045776367,-0.8779000043869019,-2.0536999702453613,-1.3408000469207764,-1.3408000469207764,-0.38530001044273376,0.7063000202178955,-9.999899864196777,-0.4677000045776367,0.7721999883651733,0.025100000202655792,1.1263999938964844,-6.324900150299072,-0.1509999930858612,-0.4399000108242035,-0.9944999814033508,-0.9944999814033508,-0.4677000045776367,-1.0363999605178833,-1.7506999969482422,1.2265000343322754,-0.8779000043869019,0.6128000020980835,-0.050200000405311584,0.5827999711036682,-0.7063000202178955,-0.6432999968528748,-0.23725003004074097,0.025100000202655792,0.4124999940395355,0.7721999883651733,-1.0990500450134277)
Value<-c(Value,0.9944999814033508,-0.2533000111579895,1.2560999393463135,-0.21819999814033508,-1.1749999523162842,-0.38530001044273376,-0.4399000108242035,-0.7063000202178955,-2.478300094604492,-2.4323999881744385,0.9154000282287598,-0.23725003004074097,-0.38530001044273376,-1.6448999643325806,-0.050200000405311584,1.8499999046325684,-0.38530001044273376,-0.6432999968528748,-4.571800231933594,-6.693999767303467,-1.7506999969482422,1.080299973487854,0.4124999940395355,-1.3408000469207764,-5.93179988861084,-0.35850000381469727,-0.6432999968528748,-0.4124999940395355,-1.0990500450134277,-0.9944999814033508,-0.8064000010490417)
Group<-factor(c(rep('D',18),rep('C',1),rep('A',7),rep('B',34),rep('E',3),rep('F',4),rep('G',10),rep('H',2),rep('I',29),rep('J',16),rep('N',1),rep('M',1),rep('Z',2),rep('X',67),rep('O',1)))
mydata<-data.frame(Group, Value)
summary(aov(Value ~Group,mydata))
TukeyHSD(aov(Value ~Group))
我的问题是:
答案 0 :(得分:0)
我认为您可以使用dimnames访问不同组的名称。
根据您的示例,测试第二组
tR <- TukeyHSD(aov(Value ~Group))
if( tR$Groups[2,4] < 0.05 ) {
paste("Group", dimnames(tR$Groups)[[1]][2] , "has a Probablity of" , tR$Groups[2, 4])
}