Learn R Programming

ecodist (version 1.2.9)

nmds: Non-metric multidimensional scaling

Description

Non-metric multidimensional scaling.

Usage

nmds(dmat, mindim = 1, maxdim = 2, nits = 10, iconf = 0, epsilon = 1e-12, 
    maxit = 500, trace = FALSE, stresscalc="default")

Arguments

dmat

lower-triangular dissimilarity matrix.

mindim

optional, minimum number of dimensions to use.

maxdim

optional, maximum number of dimensions to use.

nits

optional, number of separate ordinations to use.

iconf

optional, initial configuration. If not specified, then a random configuration is used.

epsilon

optional, acceptable difference in stress.

maxit

optional, maximum number of iterations.

trace

if TRUE, will write progress indicator to the screen.

stresscalc

if "default" uses modified stress calculation; if "kruskal" uses unmodified Kruskal stress calculation.

Value

conf

list of configurations.

stress

list of final stress values.

r2

total variance explained by each configuration.

The first results are for the lowest number of dimensions (total number is (mindim - maxdim + 1) * nits).

Details

The goal of NMDS is to find a configuration in a given number of dimensions which preserves rank-order dissimilarities as closely as possible. The number of dimensions must be specified in advance. Because NMDS is prone to finding local minima, several random starts must be used. Stress is used as the measure of goodness of fit. A lower stress indicates a better match between dissimilarity and ordination.

References

Kruskal, J.B. 1964. Multidimensional scaling by optimizing goodness of fit to a nonmetric hypothesis. Psychometrika 29:1-27.

Minchin, P.R. 1987. An evaluation of the relative robustness of techniques for ecological ordination. Vegetatio 96:89-108.

See Also

nmds.min, vf

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
# Example of multivariate analysis using built-in iris dataset
data(iris)
iris <- iris[seq(1, 150, by=3),]
iris.md <- distance(iris[,1:4], "mahal")

# Minimum-stress 2-dimensional nonmetric multidimensional scaling configuration
# Uses small number of separate ordinations (5) to increase speed of example.
# Use more for final analysis.
iris.nmds <- nmds(iris.md, mindim=2, maxdim=2, nits=3)
iris.nmin <- nmds.min(iris.nmds)

# Plot NMDS result with symbols denoting species
plot(iris.nmin, pch=as.numeric(iris[,5]))

# Fit vectors for the main variables to the NMDS configuration
iris.vf <- vf(iris.nmin, iris[,1:4], nperm=10)
plot(iris.vf, col="blue")
# }

Run the code above in your browser using DataLab