Function goodness.metaMDS
find goodness of fit measure for
points in nonmetric multidimensional scaling, and function
stressplot
makes a Shepard
diagram.
# S3 method for metaMDS
goodness(object, dis, ...)
# S3 method for default
stressplot(object, dis, pch, p.col = "blue", l.col = "red",
lwd = 2, ...)
Function goodness
returns a vector of values. Function
stressplot
returns invisibly an object with items for
original dissimilarities, ordination distances and fitted values.
A result object from metaMDS
,
monoMDS
or isoMDS
.
Dissimilarities. This should not be used with
metaMDS
or monoMDS
, but must be used with
isoMDS
.
Plotting character for points. Default is dependent on the number of points.
Point and line colours.
Line width. For monoMDS
the default is
lwd = 1
if more than two lines are drawn, and lwd = 2
otherwise.
Other parameters to functions, e.g. graphical parameters.
Jari Oksanen.
Function goodness.metaMDS
finds a goodness of fit statistic
for observations (points). This is defined so that sum of squared
values is equal to squared stress. Large values indicate poor fit.
The absolute values of the goodness statistic depend on the
definition of the stress: isoMDS
expresses
stress in percents, and therefore its goodness values are 100 times
higher than those of monoMDS
which expresses the
stress as a proportion.
Function stressplot
draws a Shepard diagram which is a plot
of ordination distances and monotone or linear fit line against
original dissimilarities. In addition, it displays two
correlation-like statistics on the goodness of fit in the graph.
The nonmetric fit is based on stress \(S\) and defined as \(R^2
= 1-S^2\). The “linear fit” is the squared
correlation between fitted values and ordination distances. For
monoMDS
, the “linear fit” and \(R^2\)
from “stress type 2” are equal.
Both functions can be used with metaMDS
,
monoMDS
and isoMDS
. The original
dissimilarities should not be given for monoMDS
or
metaMDS
results (the latter tries to reconstruct the
dissimilarities using metaMDSredist
if
isoMDS
was used as its engine). With
isoMDS
the dissimilarities must be given. In
either case, the functions inspect that dissimilarities are
consistent with current ordination, and refuse to analyse
inconsistent dissimilarities. Function goodness.metaMDS
is
generic in vegan, but you must spell its name completely with
isoMDS
which has no class.
data(varespec)
mod <- metaMDS(varespec)
stressplot(mod)
gof <- goodness(mod)
gof
plot(mod, display = "sites", type = "n")
points(mod, display = "sites", cex = 2*gof/mean(gof))
Run the code above in your browser using DataLab