Learn R Programming

vegan (version 1.0-1)

vectorfit: Fits an Environmental Vector to an Ordination

Description

The function fits environmental vectors onto an ordination, so that projection of points onto vectors have maximum correlations with corresponding environmental variables.

Usage

vectorfit(X, P)

Arguments

X
Ordination configuration.
P
Matrix or vector of environmental variable(s).

Value

  • Returns a matrix where rows correspond to environmental variables and first $k$ columns labeled head1 ...headk give the endpoints of environmental vectors (or their direction cosines) and the last row gives the correlation coefficient to the fitted vector. The vectors are of unit length. Further scaling is left for the user.

Details

The function finds directions in the ordination space towards which the environmental vectors change most rapidly and to which they have maximal correlations with the ordination configuration.

References

I found this in folklore...I hope this is correct...

See Also

isoMDS

Examples

Run this code
library(MASS)
library(mva)
data(varespec)
data(varechem)
vare.dist <- vegdist(wisconsin(varespec))
vare.mds <- isoMDS(vare.dist)
vare.points <- postMDS(vare.mds$points, vare.dist)
vare.fit <- vectorfit(vare.points, varechem)
## Scale vectors by correlation coefficient
vare.wfit <- vare.fit[,1:2]*sqrt(vare.fit[,"r"])
eqscplot(vare.points, pch="+", tol=0.1)
arrows(0,0, vare.wfit[,1], vare.wfit[,2], len=0.1, col="blue")
text(1.05*vare.wfit, rownames(vare.wfit))

Run the code above in your browser using DataLab