metaMDS {vegan}R Documentation

Nonmetric Multidimensional Scaling with Stable Solution from Random Starts, Axis Scaling and Species Scores


Function metaMDS uses isoMDS to perform Nonmetric Multidimensional Scaling (NMDS), but tries to find a stable solution using several random starts (function initMDS). In addition, it standardizes the scaling in the result, so that the configurations are easier to interpret (function postMDS), and adds species scores to the site ordination (function wascores).


metaMDS(comm, distance = "bray", k = 2, trymax = 20, autotransform =TRUE,
        noshare = 0.1, wascores = TRUE, expand = TRUE, trace = 1,
        plot = FALSE,, old.wa = FALSE, ...)
## S3 method for class 'metaMDS':
plot(x, display = c("sites", "species"), choices = c(1, 2),
     type = "p", shrink = FALSE,  ...)
## S3 method for class 'metaMDS':
points(x, display = c("sites", "species"),
        choices = c(1,2), shrink = FALSE, select, ...)
## S3 method for class 'metaMDS':
text(x, display = c("sites", "species"), labels, 
        choices = c(1,2), shrink = FALSE, select, ...)
## S3 method for class 'metaMDS':
scores(x, display = c("sites", "species"), shrink = FALSE, 
        choices, ...)
metaMDSdist(comm, distance = "bray", autotransform = TRUE, noshare = 0.1, 
    trace = 1, commname, zerodist = "fail", distfun = vegdist, ...)
metaMDSiter(dist, k = 2, trymax = 20, trace = 1, plot = FALSE,, 
initMDS(x, k=2)
postMDS(X, dist, pc=TRUE, center=TRUE, halfchange, threshold=0.8,
        nthreshold=10, plot=FALSE, ...)
metaMDSredist(object, ...)
metaMDSrotate(object, vec, choices, ...)


comm Community data. Alternatively, dissimilarities either as a dist structure or as a symmetric square matrix. In the latter case all other stages are skipped except random starts and centring and pc rotation of axes.
distance Dissimilarity index used in vegdist.
k Number of dimensions in isoMDS.
trymax Maximum number of random starts in search of stable solution.
autotransform Use simple heuristics for possible data transformation (see below).
noshare Proportion of site pairs with no shared species to trigger stepacross to find flexible shortest paths among dissimilarities.
wascores Calculate species scores using function wascores.
expand Expand weighted averages of species in wascores.
trace Trace the function; trace = 2 or higher will be more voluminous.
plot Graphical tracing: plot interim results. You may want to set par(ask = TRUE) with this option. Start searches from a previous solutions. Otherwise use isoMDS default for the starting solution.
old.wa Use the old way of calculating WA scores for species: in vegan versions 1.12-5 and 1.11-2 WA scores were based on untransformed data even when data were transformed in analysis, but since then the similar transformation will be used in WA scores as in ordination.
x Dissimilarity matrix for isoMDS or plot object.
choices Axes shown.
type Plot type: "p" for points, "t" for text, and "n" for axes only.
display Display "sites" or "species".
shrink Shrink back species scores if they were expanded originally.
labels Optional test to be used instead of row names.
select Items to be displayed. This can either be a logical vector which is TRUE for displayed items or a vector of indices of displayed items.
X Configuration from multidimensional scaling.
commname The name of comm: should not be given if the function is called directly.
zerodist Handling of zero dissimilarities: either "fail" or "add" a small positive value, or "ignore".
distfun Dissimilarity function. Any function returning a dist object and accepting argument method can be used (but some extra arguments may cause name conflicts).
dist Dissimilarity matrix used in multidimensional scaling.
pc Rotate to principal components.
center Centre the configuration.
halfchange Scale axes to half-change units. This defaults TRUE when dissimilarities were evaluated within metaMDS and the dissimilarity index has an upper limit of 1. If FALSE, the ordination dissimilarities are scaled to the same range as the input dissimilarities.
threshold Largest dissimilarity used in half-change scaling.
nthreshold Minimum number of points in half-change scaling.
object A result object from metaMDS.
vec A continuous site variable (vector).
... Other parameters passed to functions.


Non-metric Multidimensional Scaling (NMDS) is commonly regarded as the most robust unconstrained ordination method in community ecology (Minchin 1987). Functions initMDS and postMDS together with some other functions are intended to help run NMDS wit isoMDS like recommended by Minchin (1987). Function metaMDS combines all recommendations into one command for a shotgun style analysis. The complete steps in metaMDS are:

  1. Transformation: If the data values are larger than common class scales, the function performs a Wisconsin double standardization using wisconsin. If the values look very large, the function also performs sqrt transformation. Both of these standardization are generally found to improve the results. However, the limits are completely arbitrary (at present, data maximum 50 triggers sqrt and >9 triggers wisconsin). If you want to have a full control of the analysis, you should set autotransform = FALSE and make explicit standardization in the command.
  2. Choice of dissimilarity: For a good result, you should use dissimilarity indices that have a good rank order relation to ordering sites along gradients (Faith et al. 1987). The default is Bray dissimilarity, because it often is the test winner. However, any other dissimilarity index in vegdist can be used. Function rankindex can be used for finding the test winner for you data and gradients.
  3. Step-across dissimilarities: Ordination may be very difficult if a large proportion of sites have no shared species. In this case, the results may be improved with stepacross dissimilarities, or flexible shortest paths among all sites. The stepacross is triggered by option noshare. If you do not like manipulation of original distances, you should set noshare = 1.
  4. NMDS with random starts: NMDS easily gets trapped into local optima, and you must start NMDS several times from random start to be confident that you have found the global solution. The default in isoMDS is to start from metric scaling (with cmdscale) which typically is close to a local optimum. The strategy in metaMDS is to first run a default isoMDS, or use the solution if supplied, and take its solution as the standard (Run 0). Then metaMDS starts isoMDS from several random starts (maximum number is given by trymax). If a solution is better (has a lower stress) than the previous standard, it is taken as the new standard. If the solution is better or close to a standard, metaMDS compares two solutions using Procrustes analysis using function procrustes with option symmetric = TRUE. If the two solutions are very similar in their Procrustes rmse and the largest residual is very small, the solutions are regarded as convergent and the best one is saved. Please note that the conditions are stringent, and you may have found good and relatively stable solutions although the function is not yet satisfied. Setting trace = TRUE will monitor the final stresses, and plot = TRUE will display Procrustes overlay plots from each comparison. This is the only step performed if input data (comm) were dissimilarities.
  5. Scaling of the results: metaMDS will run postMDS for the final result. Function postMDS provides the following ways of ``fixing'' the indeterminacy of scaling and orientation of axes in NMDS: Centring moves the origin to the average of the axes. Principal components rotate the configuration so that the variance of points is maximized on first dimension (with function metaMDSrotate you can alternatively rotate the configuration so that the first axis is parallel to an environmental variable). Half-change scaling scales the configuration so that one unit means halving of community similarity from replicate similarity. Half-change scaling is based on closer dissimilarities where the relation between ordination distance and community dissimilarity is rather linear; the limit is controlled by parameter threshold. If there are enough points below this threshold (controlled by the parameter nthreshold), dissimilarities are regressed on distances. The intercept of this regression is taken as the replicate dissimilarity, and half-change is the distance where similarity halves according to linear regression. Obviously the method is applicable only for dissimilarity indices scaled to 0 ... 1, such as Kulczynski, Bray-Curtis and Canberra indices. If half-change scaling is not used, the ordination is scaled to the same range as the original dissimilarities.
  6. Species scores: Function adds the species scores to the final solution as weighted averages using function wascores with given value of parameter expand. The expansion of weighted averages can be undone with shrink = TRUE in plot or scores functions, and the calculation of species scores can be suppressed with wascores = FALSE.


Function metaMDS returns an object of class metaMDS. The final site ordination is stored in the item points, and species ordination in the item species. The other items store the information on the steps taken by the function. The object has print, plot, points and text methods. Functions metaMDSdist and metaMDSredist return vegdist objects. Function initMDS returns a random configuration which is intended to be used within isoMDS only. Functions metaMDSiter and postMDS returns the result of isoMDS with updated configuration.


The calculation of wascores for species was changed in vegan version 1.12-6. They are now based on the community data transformed similarly as in the ordination. Previously the species scores always were based on the original data. You can re-establish the old behaviour with argument old.wa = TRUE.


Function metaMDS is a simple wrapper for isoMDS and some support functions. You can call these support functions separately for better control of results. Data transformation, dissimilarities and possible stepacross are made in function metaMDSdist which returns a dissimilarity result. Iterative search (with starting values from initMDS) is made in metaMDSiter. Processing of result configuration is done in postMDS, and species scores added by wascores. If you want to be more certain of reaching a global solution, you can compare results from several independent runs. You can also continue analysis from previous results or from your own configuration. Function does not save the used dissimilarity matrix, but metaMDSredist tries to reconstruct the used dissimilarities with original data transformation and possible stepacross.


Jari Oksanen


Faith, D. P, Minchin, P. R. and Belbin, L. (1987). Compositional dissimilarity as a robust measure of ecological distance. Vegetatio 69, 57–68.

Minchin, P.R. (1987) An evaluation of relative robustness of techniques for ecological ordinations. Vegetatio 69, 89–107.

See Also

isoMDS, decostand, wisconsin, vegdist, rankindex, stepacross, procrustes, wascores, ordiplot.


## The recommended way of running NMDS (Minchin 1987)
library(MASS) ## isoMDS
sol <- metaMDS(dune)
plot(sol, type="t")

## Start from previous best solution
sol2 <- metaMDS(dune, = sol)

[Package vegan version 1.16-32 Index]