PERMANOVA原理解释:这个统计检验可用于判断PCA/PCoA等的分群效果是否显著!
在检验完某个因素对物种组成有显著影响后,如果关注该因素不同水平对物种的构成是否存在显著影响,就需要逐一对每两对水平进行检验了。
adonis
分析可以检验某个因素整体对物种组成差异的影响,但不能比较这个因素的多个水平之间两两是否差异显著,如Management
中的BF
与HM
两种方式是否对物种组成差异有显著影响?
这时就需要pairwise.adonis
来进行配对检验了。
# devtools::install_github("pmartinezarbizu/pairwiseAdonis/pairwiseAdonis")
library(pairwiseAdonis)
# This is a wrapper function for multilevel pairwise comparison
# using adonis() from package 'vegan'.
# The function returns adjusted p-values using p.adjust().
dune.pairwise.adonis <- pairwise.adonis(x=dune, factors=dune.env$Management, sim.function = "vegdist",
sim.method = "bray",
p.adjust.m = "BH",
reduce = NULL,
perm = 999)
dune.pairwise.adonis
## pairs Df SumsOfSqs F.Model R2 p.value p.adjusted sig
## 1 SF vs BF 1 0.4016624 2.514890 0.2643110 0.055 0.0825
## 2 SF vs HF 1 0.2828804 1.857489 0.1710790 0.117 0.1404
## 3 SF vs NM 1 0.7575728 3.425694 0.2551595 0.008 0.0480 .
## 4 BF vs HF 1 0.1617135 1.567531 0.2071390 0.197 0.1970
## 5 BF vs NM 1 0.5662456 2.715242 0.2794827 0.017 0.0510
## 6 HF vs NM 1 0.6513088 3.423068 0.2755413 0.031 0.0620
拼一起画个图
library(ggpubr)
library(patchwork)
tab2 <- ggtexttable(dune.pairwise.adonis[,c("pairs","R2","p.value","p.adjusted")], rows = NULL,
theme = ttheme("blank")) %>%
tab_add_hline(at.row = 1:2, row.side = "top", linewidth = 1) %>%
tab_add_hline(at.row = nrow(dune.pairwise.adonis)+1, row.side = "bottom", linewidth = 1)
p2 = p + tab2
p2
p2 + plot_layout(design=c(area(1,1), area(2,1)))
# p / tab2
# 调布局
ANOSIM
和PERMANOVA
的pairwise analysis声明:“Pairwise tests are not possible in vegan. My understanding is that the non-R software with such tests makes separate pairwise tests using subsets of data with only two levels of a factor in one test. We don’t provide that in vegan and have no plans to provide this in the future.” (cited by Jari Oksanen, author of anosim and Adonis{vegan} in R)https://stat.ethz.ch/pipermail/r-sig-ecology/2013-June/003865.html