envfit {vegan} | R Documentation |
The function fits environmental vectors or factors onto an ordination. The projection of points onto vectors have maximum correlations with corresponding environmental variables, and the factors show the averages of factor levels.
envfit(X, P, permutations = 0, strata, choices=c(1,2)) ## S3 method for class 'envfit': plot(x, choices = c(1,2), arrow.mul = 1, p.max = NULL, col = "blue", add = TRUE, ...) vectorfit(X, P, permutations = 0, strata, choices=c(1,2)) factorfit(X, P, permutations = 0, strata, choices=c(1,2))
X |
Ordination configuration. |
P |
Matrix or vector of environmental variable(s). |
permutations |
Number of permutations for assessing significance of vectors or factors. |
x |
A result object from envfit . |
choices |
Axes to plotted. |
arrow.mul |
Multiplier for vector lengths. |
p.max |
Maximum estimated P value for displayed
variables. You must calculate P values with setting
permutations to use this option. |
col |
Colour in plotting. |
add |
Results added to an existing ordination plot. |
strata |
An integer vector or factor specifying the strata for permutation. If supplied, observations are permuted only within the specified strata. |
... |
Parameters to text function. |
Function envfit
finds vectors or factor averages of
environmental variables. Function plot.envfit
adds these in an
ordination diagram. If X
is a data.frame
,
envfit
uses factorfit
for factor
variables and
vectorfit
for other variables. If X
is a matrix or a
vector, envfit
uses only vectorfit
.
Functions vectorfit
and factorfit
can be called directly.
Function vectorfit
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. Function factorfit
finds averages of ordination
scores for factor levels.
If permutations
> 0, the `significance' of fitted vectors
or factors is assessed using permutation of environmental variables.
The goodness of fit statistic is squared correlation coefficient
(r^2).
For factors this is defined as r^2 = 1 - ss_w/ss_t, where
ss_w and ss_t are within-group and total sums of squares.
Functions vectorfit
and factorfit
return lists of
classes vectorfit
and factorfit
which have a
print
method. The result object have the following items:
arrows |
Arrow endpoints from vectorfit . The arrows are
scaled to unit length. |
centroids |
Class centroids from factorfit . |
r |
Goodness of fit statistic: Squared orrelation coefficient |
permutations |
Number of permutations. |
pvals |
Empirical P-values for each variable. |
Function envfit
returns a list of class envfit
with
results of vectorfit
and envfit
as items.
Function plot.envfit
scales the vectors by correlation.
Fitted vectors have become the method of choice in displaying
environmental variables in ordination. Indeed, they are the optimal
way of presenting environmental variables in Constrained
Correspondence Analysis cca
, since there they are the
linear constraints.
In unconstrained ordination the relation between external variables
and ordination configuration may be less linear, and therefore other
methods than arrows may be more useful. The simplest is to adjust the
plotting symbol sizes (cex
, symbols
) by
environmental variables.
Fancier methods involve smoothing and regression methods that
abound in R, and ordisurf
provides a wrapper for some.
Jari Oksanen. The permutation test derives from the code suggested by Michael Scroggie.
A better alternative to vectors may be ordisurf
.
data(varespec) data(varechem) library(MASS) library(mva) vare.dist <- vegdist(wisconsin(varespec)) vare.mds <- isoMDS(vare.dist) vare.mds <- postMDS(vare.mds, vare.dist) vare.fit <- envfit(vare.mds$points, varechem, 1000) vare.fit ordiplot(vare.mds) plot(vare.fit) plot(vare.fit, p.max = 0.05, col = "red")