2

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))))
RenaudJau
  • 21
  • 2
  • It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Jul 09 '20 at 17:46
  • Thanks, I provided an example. – RenaudJau Jul 10 '20 at 12:48

1 Answers1

0

This can be done, but it is not implemented in vegan. Reason for leaving it non-implemented is that the user-interface would be cumbersome. I do it myself, but I can take the pain of UI.

Jari Oksanen
  • 3,287
  • 1
  • 11
  • 15