3 - Create scree plots using the metaMDS function in the VEGAN package.

There does not appear to be a built-in function in VEGAN for creating scree plots. Since scree plots are useful for choosing how many dimensions should be used with the metaMDS function, reference to a sample function is provided. In this example, stress values from ten replicates for a range of dimensions is plotted.

The original NMDS.scree function is from the following webpage: http://www.pmc.ucsc.ecu/~mclapham/Rtips/ordination.htm

This page is a good source for learning how to perform multivariate ordinations in [R].

This function (slightly modified from the reference above) should be added to your R script:

nmds.scree<-function(x) {

plot(rep(1,10), replicate(10, metaMDS(x, autotransform=F, k=1)$stress), xlim=c(1,nrow(x)), ylim=c(0,0.5), xlab="# of Dimensions", ylab="Stress", main="NMDS stress plot")

for (i in 1:(nrow(x)-2)) {

points(rep(i+1,10), replicate(10, metaMDS(x, autotransform=F, k=i+1)$stress))

}

}

Sample R commands:

object<-read.csv(file="symmetric_distancematric.csv", head=TRUE, row.names=1)

pdf("NMDS_scree.pdf")

nmds.scree(object)

dev.off()