distconstrain | R Documentation |
Function constrains dissimilarities by external variables, or
alternatively removes effects of constraining variables and returns
residual dissimilarities. The analysis is based on McArdle &
Anderson (2001), and the analysis of constrained dissimilarities is
equal to distance-based Redundancy Analysis
(dbrda
).
distconstrain(formula, data, add = FALSE, residuals = FALSE, squared = FALSE)
formula |
The left-hand-side must be dissimilarities and the right-hand-side should list the constraining variables. |
data |
Data frame containing the constrainging variables in
the |
add |
an additive constant is added to the non-diagonal
dissimilarities such that all |
residuals |
Return residuals after constraints. |
squared |
Return squared dissimilarities instead of
dissimilarities. This allows handling negative squared distances by
the user instead of setting them |
Function uses the method of McArdle & Anderson (2001) to
constrain dissimilarities by external variables, or alternatively,
to find residual dissimilarities after constraints. With Euclidean
distances, the method is equal to performing linear regressions on
each column in the raw data and then calculationg the distances,
but works directly on distances. With other methods, there is no
similar direct connection to the raw data, but it is possible to
work with non-Euclidean metrics. The same basic method is used
within db-RDA (dbrda
in vegan), but
this function exposes the internal calculations to users.
Non-Euclidean indices can produce negative eigenvalues in
db-RDA. Would negative eigenvalues be produced, this function can
return negative squared distances resulting in NaN
when
taking the square root. Db-RDA works with the internal presentation
of the dissimilarities, and its analysis does not suffer from the
imaginary distances, but these can ruin the analysis of
dissimilarities returned from this function.
McArdle, B.H. & Anderson, M.J. (2001). Fitting multivariate models to community data: a comment on distance-based redundancy analysis. Ecology 82, 290–297.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.