shepard_plot | R Documentation |
This function helps to estimate the representativeness of ordinations obtained using any reduced-space ordination method.
shepard_plot(dis, ord, k = 2, show = TRUE)
dis |
Original dissimilarity matrix (class "dist") |
ord |
Ordination scores (class "matrix" or "data.frame") or (class "dist") |
k |
Number of dimensions (default, 2) that will be taken into account (only if the ordination scores were provided in 'ord') |
show |
Logical; show the resulting plot on screen |
This function compares original dissimilarities among the objects with Euclidean distances in reduced space obtained with ordination (object scores or coordinates of the objects in the reduced space). If the points are close to diagonal then the projection in reduced space accounts for a high fraction of the variance.
Invisible returns ggplot-object.
Legendre P. & Legendre L. Numerical Ecology. 2012. 3rd Ed. - Chapter 9 (Ordination in reduced space).
vegan::stressplot
, MAAS::Shepard
library(vegan)
data(dune)
ds <- decostand(dune, method = "total", MARGIN = 1) # standardize data to species relative abundance
dd <- vegdist(ds, method = "bray") # compute dissimilarity between samples
ord <- monoMDS(dd, k = 5) # NMDS (non-metric multidimensional scaling)
dd.ord <- dist( scores(ord) ) # Euclidean distance in reduced space
shepard_plot(dis = dd, ord = dd.ord) # Bray-Curtis vs distance in reduced space (k-dimensional)
shepard_plot(dis = dd, ord = scores(ord), k = 2) # Bray-Curtis vs distance in reduced space (only first 2 dimensions)
shepard_plot(dis = dd, ord = scores(ord), k = 3) # Bray-Curtis vs distance in reduced space (first 3 dimensions)
# Example with phyloseq wrappers
data("GlobalPatterns")
dd <- distance(GlobalPatterns, method = "unifrac", type = "samples")
ord <- ordinate(GlobalPatterns, method = "NMDS", distance = dd)
shepard_plot(dis = dd, ord = scores(ord))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.