MDSrotate: Rotate First MDS Dimension Parallel to an External Variable

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Function rotates a multidimensional scaling result so that its first dimension is parallel to an external (environmental variable). The function can handle the results from metaMDS or monoMDS functions.

Usage

1
MDSrotate(object, vec, na.rm = FALSE, ...)

Arguments

object

A result object from metaMDS or monoMDS.

vec

A continuous environmental variable or a matrix of such variables. The number of variables must be lower than the number of dimensions, and the solution is rotated to these variables in the order they appear in the matrix.

na.rm

Remove missing values from the continuous variable vec.

...

Other arguments (ignored).

Details

The orientation and rotation are undefined in multidimensional scaling. Functions metaMDS and metaMDS can rotate their solutions to principal components so that the dispersion of the points is highest on the first dimension. Sometimes a different rotation is more intuitive, and MDSrotate allows rotation of the result so that the first axis is parallel to a given external variable or two first variables are completely in a two-dimensional plane etc. If several external variables are supplied, they are applied in the order they are in the matrix. First axis is rotated to the first supplied variable, and the second axis to the second variable. Because variables are usually correlated, the second variable is not usually aligned with the second axis, but it is uncorrelated to later dimensions. There must be at least one free dimension: the number of external variables must be lower than the number of dimensions, and all used environmental variables are uncorrelated with that free dimension.

Value

Function returns the original ordination result, but with rotated scores (both site and species if available), and the pc attribute of scores set to FALSE.

Author(s)

Jari Oksanen

See Also

metaMDS, monoMDS.

Examples

1
2
3
4
5
6
7
8
data(varespec)
data(varechem)
mod <- monoMDS(vegdist(varespec))
mod <- with(varechem, MDSrotate(mod, pH))
plot(mod)
ef <- envfit(mod ~ pH, varechem, permutations = 0)
plot(ef)
ordisurf(mod ~ pH, varechem, knots = 1, add = TRUE)

Example output

Loading required package: permute
Loading required package: lattice
This is vegan 2.4-3

Family: gaussian 
Link function: identity 

Formula:
y ~ poly(x1, 1) + poly(x2, 1)
Total model degrees of freedom 3 

REML score: -3.076658     

vegan documentation built on May 2, 2019, 5:51 p.m.