如何将向量(说明年度变化)添加到ordihull图中?我已经创建了一个ordihull图,分别用它自己的颜色描绘了2011,2013和2015年。现在我想看看所有的位置是朝同一方向变化的,还是随机移动的。从统计学上讲,我在轴3上发现了一个显着的变化,因此我想应用矢量来放大这种变化。从图中看,变化并不像现在这样明显。Ordihull plot of 3 years
我的脚本:
library(vegan)
matrix_s = read.table('matrix_s.txt', sep = "\t", header = TRUE)
matrixfit4 <- metaMDS(matrix_s, k=4, trymax=50, distance="bray")
ordiplot(matrixfit4,display = "site",type="p",choices = c(2,3))
ordihull(matrixfit4, K4Full$Year, display = "sites", show.groups = "2011",col= c("purple"),choices = c(2,3), draw = "polygon")
ordihull(matrixfit4, K4Full$Year, display = "sites", show.groups = "2013",col= c("red"), choices = c(2,3),draw = "polygon")
ordihull(matrixfit4, K4Full$Year, display = "sites", show.groups = "2015",col= c("orange"),choices = c(2,3), draw = "polygon")
legend(-1.195, 1.555, unique(K4Full$Year), text.col =c("purple","red","orange"),cex=1)发布于 2016-09-27 03:34:44
我不认为向量是正确的方法;怎么能想到增加year==2013数量的方向呢?对于像这样的分类变量,在排序空间中考虑质心是更自然的。
例如,考虑使用内置的荷兰沙丘草地数据的插图
library("vegan")
data(dune, dune.env)
set.seed(42)
ord <- metaMDS(dune)
cols <- c("purple","red","orange","black")
plot(ord, type = "n")
with(dune.env, points(ord, col = cols[Management]))
with(dune.env, ordihull(ord, Management, col = cols))
ev <- envfit(ord ~ Management, data = dune.env)
plot(ev, add = TRUE)这将为您提供如下所示的图:

envfit()函数包含Management效果的一个测试
> ev
***FACTORS:
Centroids:
NMDS1 NMDS2
ManagementBF -0.4534 -0.0102
ManagementHF -0.2636 -0.1282
ManagementNM 0.2958 0.5790
ManagementSF 0.1506 -0.4670
Goodness of fit:
r2 Pr(>r)
Management 0.4134 0.004 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Permutation: free
Number of permutations: 999这样做的目的是测试与没有分组的空模型相比,组质心的平方偏差总和是否解释了更多的变化,在零模型下,我们将有与数据整体质心的平方偏差总和。质心是相对于这里使用的两个NMDS维度的,但在您的示例中设置k = 4时,这将是四个维度。
替代测试是PERMANOVA方法,它在素食中化名为adonis(),基于距离的冗余分析(最近版本的素食中的dbrda()),或者简单的普通或花园约束排序。
例如,我在这里使用典型对应分析(CCA)并测试无Management效应的零假设
mod <- cca(dune ~ Management, data = dune.env)
set.seed(1)
anova(mod)最后一行给出:
> anova(mod)
Permutation test for cca under reduced model
Permutation: free
Number of permutations: 999
Model: cca(formula = dune ~ Management, data = dune.env)
Df ChiSquare F Pr(>F)
Model 3 0.60384 2.1307 0.004 **
Residual 16 1.51143
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1这些结果支持上面使用的envfit()方法。
请注意,我并不是说我在这里所做的任何选择都真正适用于荷兰沙丘草地数据,我只是在说明素食中的函数是如何工作的-我睡得太少了,以至于无法回忆起如何处理这个数据集中的有序物种丰富度。
发布于 2016-09-27 15:55:32
这可能是一项棘手的任务--取决于您的意思。然而,要分析变化是线性的还是更复杂的,是相对简单的。下面是在素食中使用dune和dune.env数据的示例
mod <- metaMDS(dune, trace=FALSE)
## Moisture to a matrix of polynomial contrasts
mois <- model.matrix(~ Moisture, dune.env)[,-1] # drop (Intercept)
envfit(mod ~ ., as.data.frame(mois))这表明只有一次项或线性变化是显着的,而曲线(二次)和更复杂(三次)的项是次要的。在本例中,Moisture被定义为dune.env中的有序因子。您必须注意您的Year也被定义为有序的,以便产生多项式对比度,并检查级别是否处于正确的顺序。
关于定向运动的重要性还有更复杂的测试。我认为Peter Minchin已经发表了其中的一些(参见Wetland 22, 1-17;2002)。
https://stackoverflow.com/questions/39703511
复制相似问题