Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/8


前面都是对一两个样本的检查,现在考虑k个样本的情况,我们的假设是:

  • Analysis of Variance (ANOVA)

assumptions are:

  1. Groups are independent
  2. Distributions are Normally distributed
  3. Groups have equal variances

那么我们的假设就是:

H0:μ1=μ2=μ3
H1:at least one not equal

R里面使用anova函数,具体可以参见以前的代码。(计算α多样性指数中的Simpson Index)

simpsonBox = read.csv("simpsonIndex1.csv")
Group = factor(c(rep(1,21), rep(22,21), rep(43,20)), labels = c("A", "B", "C"))
simpsonData = data.frame(simpsonIndex = simpsonBox$x, group = Group)
# 非参数检验,检查方差是否相同
fligner.test(shannonIndex ~ group, data = shannonData)
# 正态分布的数据,检查方差是否相同
bartlett.test(simpsonIndex ~ group, data = simpsonData)
# anova
simpsonAov <- aov(simpsonIndex ~ group, data = simpsonData)
summary(simpsonAov)

  

  • 非参数的方法则是kruskal test

kruskal.test


上面的anova分析之后,如果我们拒绝了原假设,知道几个组的均值是不同的,那么两两组之间,它们差异的显著性如何?

就像之前做过的TukeyHSD(要求数据正态分布),我们还可以做

  • Bonferroni Adjustment

The Bonferroni adjustment simply divides the Type I error rate (.05) by the number of tests (in this case, three).

pairwise.t.test(simpsonData$simpsonIndex,simpsonData$group,p.adjust="bonferroni")

  我们可以比较一下,它和TukeyHSD在结果上的差别:

其实结果是一致的,都说明C组与A组的差异显著。一般认为Bonferroni更保守。我们使用的函数可以参照:

https://stat.ethz.ch/R-manual/R-devel/library/stats/html/pairwise.t.test.html


  • Holm Adjustment

这篇文章指出,Holm Adjustment比Bonferroni更好,同样使用pairwise.t.test函数。

Ref: http://rtutorialseries.blogspot.jp/2011/03/r-tutorial-series-anova-pairwise.html

  • The Fisher Least Significant Difference (LSD) method essentially does not correct for the Type I error rate

for multiple comparisons and is generally not recommended relative to other options.

library(agricolae)
LSD.test()

  

最新文章

  1. Python数据结构与算法--List和Dictionaries
  2. &ldquo;耐撕&rdquo;团队2016.05.11站立会议
  3. 收缩 虚拟硬盘 shrink vhd
  4. Activity——思维导图
  5. OpenCV - Operations on Arrays 对数组(矩阵)的一些操作
  6. ios开发-确定/自适应textView的高度
  7. Android直接通过ip进行Http请求
  8. jquery 之选择符
  9. 转:.NET 环境中使用RabbitMQ
  10. android:android:background=&quot;#00000000&quot;,透明效果
  11. 浅谈Web前端浏览器兼容问题
  12. Bestcoder #80
  13. Mac实用操作技巧(六)
  14. indexer_worker.go
  15. 从零开始学习PYTHON3讲义(六)for循环跟斐波那契数列
  16. [Leetcode]895.最大频率栈
  17. Windows Server 2008中使用计划任务定时执行BAT bat进行PHP脚本的执行
  18. CSS —— 选择器
  19. linux basic ------ 多命令执行
  20. scala - fold,aggregate,iterator

热门文章

  1. NET Core 2.0 的 REST API
  2. PHP函数生成随机数
  3. Aspose.word直接转pdf
  4. 值类型 VS 引用类型~
  5. 疯狂使用 leancloud (投稿文章)
  6. hystrix 应用问题
  7. 微信开发 config:invalid url domain
  8. window.open()弹出窗口参数说明及居中设置
  9. NullPointerException检测
  10. Windows7(x86) xampp php5.5 imagick install