I would like to see how one vegetation plot is ordinated if I remove one or n species from this plot. I used metaMDS
function from vegan
package and I would like to add new plot like the predict.cca
function does after a cca.
I tried to just merge my two data.frame (the original one and the modified one) before performing the metaMDS
, but the ordination moves a lot..
Does anyone has an idea on how to do that?
Here is a reproducible example of my problem:
library(vegan)
data(dune)
#the original NMDS :
NMDS <- metaMDS(dune)
plot(NMDS$points)
text(NMDS$points,labels = 1:nrow(dune))
#The suppression of one random occurence on the first plot (for instance) :
occurence_1 <- which(dune[1,]!=0) #the col number where species occur in plot 1
dune_1_mod <- dune[1,]
dune_1_mod[,sample(occurence_1,size = 1)] <- 0
#Then I would like to have a function "predict.MDS" (that I unfortunately don't know) where I could do that :
dune_1_mod_coordinates <- predict.MDS(NMDS, newdata = dune_1_mod)
#which would provide me the coordinates of my modified plot in the previous NMDS ordination and allow me to plot it on the same plot :
points(x = dune_1_mod_coordinates$points[,1], y = dune_1_mod_coordinates$points[,2])
#I tried to just add some new modified plot, run the MDS on the whole dataset and plot it, but it seems that the ordination is deeply modified and driven by the characteristics of the new modified plots
#see here :
plot(NMDS$points)
text(NMDS$points,labels = 1:nrow(dune))
occurence_1 <- which(dune[1,]!=0)
dune2 <- dune
for(i in 1:length(occurence_1))
{
dune2[i+nrow(dune),] <- dune2[1,]
dune2[i+nrow(dune),occurence_1[i]] <- 0
}
NMDS2 <- metaMDS(dune2)
plot(NMDS2$points,col=c(rep(1,nrow(dune)),rep(2,length(occurence_1))))
text(NMDS2$points,labels = c(1:nrow(dune),rep(NA,length(occurence_1))))