Post Hoc Test

最初从图书馆的一本生物统计书里大概明白了post hoc,后来时间久了又不大记得了,今天在google上搜到一篇关于post hoc的文章,看完感觉挺有收获的。以防此链接日后失效,先把它截屏拷贝过来:

 

用R做事后比较的时候,我用了一个glht函数(最初是参考这篇博文知道glht这个函数):

#方差分析
fit=aov(total[,j]~age+edu+gender+group,data=total)
  Fangcha=summary(fit)
  P$P.Fangcha[i,j]= Fangcha[[1]]$`Pr(>F)`[4]
#Post Hoc
  multicomp=summary(glht(fit,linfct=mcp(group="Tukey")),test = adjusted("fdr"))
  #multicomp=summary(glht(fit,linfct=mcp(group="Tukey")),test = adjusted("none"))
  P$P.iaeiu[i,j]=multicomp$test$pvalues[1]
  P$P.coneiu[i,j]=multicomp$test$pvalues[2]
  P$P.conia[i,j]=multicomp$test$pvalues[3]

#对glht函数的结果summary之后,得到如下结果:
> summary(glht(fit,linfct=mcp(group="Tukey")),test = adjusted("fdr"))

	 Simultaneous Tests for General Linear Hypotheses

Multiple Comparisons of Means: Tukey Contrasts


Fit: aov(formula = total[, j] ~ age + edu + gender + group, data = total)

输出结果的标题显示它使用了一个Simultaneous(同步的) Tests,所以我又查了一下Simultaneous Tests是什么:

一篇文章告诉我:

“An approach to such methods, apparently originally due to Tukey [27], is to test each component hypothesis by comparing its statistic with the αα level critical value of the statistic for the overall hypothesis. This is called a Simultaneous Test Procedure (STP for short) as all hypotheses may be tested simultaneously and without reference to one another. An STP involves no stepwise testing of the kind employed by some other methods of multiple comparisons for means, in which subsets are tested for equality only if they are contained in sets which have already been found significant. (See [3], [4], [10], [18]). ”

后来又查到一些,我现在觉得Simultaneous Tests就是指同步检验(同时进行多个检验),而进行同步检验的时候会遇到多重比较的问题,再用glht函数的时候,通过设定test=adjusted(“”)来指定多重比较校正的方法,glht函数默认的是one-step方法,我这里用的是fdr的方法。在前文中提到post hoc常用的一个方法是Tukey HSD,那么用glht的one-step与Tukey HSD有什么联系呢?有个人是这么说的

library(lsmeans)
lsmeans(m1, pairwise~Name.Origin, adjust="tukey") 

library(multcomp)
summary(glht(m1, lsm(pairwise~Name.Origin)))

simple.glht(mod, effect, corr = c("Tukey","Bonferroni","Fisher"),
	level = 0.95, ...)


“If you specify adjust = "mvt" in the lsmeans call, you'll get exactly the same results as the glht call (except for minor differences due to the fact that the computations are simulation-based). The difference would come if you summarize the tests in the glht object with some option other than the one-step method (which is the default). The one-step method protects the error rate for simultaneous confidence intervals, which is stronger (and hence more conservative) than the step-down methods. The mvt method is the exact one-step method when the distributional assumptions hold.

Also, in a nicely balanced experiment with homogeneous errors, there is no difference between the Tukey method and the mvt method. That is, the Tukey method is the mvt method for the particular covariance structure encountered in such a balanced design.”

此外,我意外发现可以直接用 TukeyHSD(model) 进行posthoc.

The Handbook for Biological Statistics中更全面的了解到用R做post hoc的一些方法(最初看这些方法不是太懂,配合前文截屏拷贝的那篇文章看会更明白一些)

Tukey and Least Significant Difference mean separation tests (pairwise comparisons) 

Tukey and other multiple comparison tests can be performed with a handful of functions.  The functions TukeyHSDHSD.test, and LSD.test are probably not appropriate for cases where there are unbalanced data or unequal variances among levels of the factor, though TukeyHSD does make an adjustment for mildly unbalanced data.  It is my understanding that the multcomp and lsmeans packages are more appropriate for unbalanced data.  Another alternative is the DTK package that performs mean separation tests on data with unequal sample sizes and no assumption of equal variances.

 

 

  • 16
    点赞
  • 42
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值