mso {vegan}R Documentation

Functions for performing and displaying a spatial partitioning of cca or rda results


The function mso adds an attribute vario to an object of class "cca" that describes the spatial partitioning of the cca object and performs an optional permutation test for the spatial independence of residuals. The function plot.mso creates a diagnostic plot of the spatial partitioning of the "cca" object.


mso(object.cca, object.xy, grain = 1, round.up = FALSE, permutations = FALSE)
msoplot(x, alpha = 0.05, explained = FALSE, ...)


object.cca An object of class cca, created by the cca or rda function.
object.xy A vector, matrix or data frame with the spatial coordinates of the data represented by object.cca. Must have the same number of rows as object.cca\$CA\$Xbar (see cca.object).
grain Interval size for distance classes.
round.up Determines the choice of breaks. If false, distances are rounded to the nearest multiple of grain. If true, distances are rounded to the upper multiple of grain.
permutations If false, suppresses the permutation test. If an integer, determines the number of permutations for the Mantel test of spatial independence of residual inertia.
x A result object of mso.
alpha Significance level for the two-sided permutation test of the Mantel statistic for spatial independence of residual inertia and for the point-wise envelope of the variogram of the total variance. A Bonferroni-type correction can be achieved by dividing the overall significance value (e.g. 0.05) by the number of distance classes.
explained If false, suppresses the plotting of the variogram of explained variance.
... Other arguments passed to functions.


The Mantel test is an adaptation of the function mantel of the vegan package to the parallel testing of several distance classes. It compares the mean inertia in each distance class to the pooled mean inertia of all other distance classes.

If there are explanatory variables (RDA, CCA, pRDA, pCCA) and a significance test for residual autocorrelation was performed when running the function mso, the function plot.mso will print an estimate of how much the autocorrelation (based on significant distance classes) causes the global error variance of the regression analysis to be underestimated


The function mso returns an amended cca or rda object with the additional attributes grain, H, H.test and vario.

grain The grain attribute defines the interval size of the distance classes .
H H is an object of class 'dist' and contains the geographic distances between observations.
H.test H.test contains a set of dummy variables that describe which pairs of observations (rows = elements of object\$H) fall in which distance class (columns).
vario The vario attribute is a data frame that contains some or all of the following components for the rda case (cca case in brackets):
Distance class as multiples of grain.
Average distance of pairs of observations in distance class H.
Number of unique pairs of observations in distance class H.
Empirical (chi-square) variogram of total variance (inertia).
Sum of empirical (chi-square) variograms of explained and residual variance (inertia).
Empirical (chi-square) variogram of residual variance (inertia).
Empirical (chi-square) variogram of explained variance (inertia).
Empirical (chi-square) variogram of conditioned variance (inertia).
Standard error of the empirical (chi-square) variogram of total variance (inertia).
P-value of permutation test for spatial independence of residual variance (inertia).


The function is based on the code published in the Ecological Archives E085-006 (


The responsible author was Helene Wagner.


Wagner, H.H. 2004. Direct multi-scale ordination with canonical correspondence analysis. Ecology 85: 342–351.

See Also

Function cca and rda, cca.object.


## Reconstruct worked example of Wagner (submitted):
X <- matrix(c(1, 2, 3, 2, 1, 0), 3, 2)
Y <- c(3, -1, -2)
tmat <- c(1:3)
## Canonical correspondence analysis (cca):
Example.cca <- cca(X, Y)
Example.cca <- mso(Example.cca, tmat)

## Correspondence analysis (ca): <- mso(cca(X), tmat)

## Unconstrained ordination with test for autocorrelation
## using oribatid mite data set as in Wagner (2004)

mite.cca <- cca(log(mite + 1))
mite.cca <- mso(mite.cca, mite.xy, grain =  1, permutations = 100)

## Constrained ordination with test for residual autocorrelation
## and scale-invariance of species-environment relationships
mite.cca <- cca(log(mite + 1) ~ SubsDens + WatrCont + Substrate + Shrub + Topo, mite.env)
mite.cca <- mso(mite.cca, mite.xy, permutations = 100)

[Package vegan version 1.16-32 Index]