繁体   English   中英

从R中的事后邓肯检验获得p值

[英]get p-values from post-hoc duncan test in r

在运行单向方差分析比较3组的平均值后,我想执行事后邓肯测试(在r中使用“ agricolae”程序包)。

## run one-way anova
> t1 <- aov(q3a ~ pgy,data = pgy)
> summary(t1)
              Df Sum Sq Mean Sq F value  Pr(>F)   
pgy            2     13   6.602   5.613 0.00367 **
Residuals   6305   7416   1.176                   
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
1541 observations deleted due to missingness

## run post-hoc duncan test
> duncan.test(t1,"pgy",group = T, console = T)

Study: t1 ~ "pgy"

Duncan's new multiple range test
for q3a 

Mean Square Error:  1.176209 

pgy,  means

          q3a      std    r Min Max
PGY1 1.604292 1.068133 2656   1   5
PGY2 1.711453 1.126446 2017   1   5
PGY3 1.656269 1.057937 1635   1   5

Groups according to probability of means differences and alpha level( 0.05 )

Means with the same letter are not significantly different.

          q3a groups
PGY2 1.711453      a
PGY3 1.656269     ab
PGY1 1.604292      b

但是,输出仅告诉我,每个组比较的PGY1和PGY2的平均值不同,没有p值(事后成对t检验将为每个组比较生成p值)。

我如何从邓肯测试中获得p值?

谢谢!!

一个解决办法是使用PostHocTestDescTools包。

这是使用warpbreaks示例数据的示例。

require(DescTools);
res <- aov(breaks ~ tension, data = warpbreaks);
PostHocTest(res, method = "duncan");
#
#  Posthoc multiple comparisons of means : Duncan's new multiple range test
#    95% family-wise confidence level
#
#$tension
#          diff    lwr.ci    upr.ci    pval
#M-L -10.000000 -17.95042 -2.049581 0.01472 *
#H-L -14.722222 -23.08443 -6.360012 0.00072 ***
#H-M  -4.722222 -12.67264  3.228197 0.23861

第一列(例如ML等)给出了每组均值之间的成对差异,以及置信区间和p值。

例如, HM之间的平均间隔差异在统计上并不显着。


如果执行Duncan的测试不是关键要求,则还可以pairwise.t.test进行其他各种多重比较校正。 例如,使用Bonferroni的方法

with(warpbreaks, pairwise.t.test(breaks, tension, p.adj = "bonferroni"));
#
#   Pairwise comparisons using t tests with pooled SD
#
#data:  breaks and tension
#
#  L      M
#M 0.0442 -
#H 0.0015 0.7158
#
#P value adjustment method: bonferroni

结果与事后邓肯测试的结果一致。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM