Computes the residuals from the phylogenetic regression of multiple y variables (in a matrix) on a single x.
phyl.resid(tree, x, Y, method="BM")
A list with the following elements:
a vector or matrix of regression coefficients.
a vector or matrix of residuals for species.
a vector of \(\lambda\) values (method="lambda"
only).
a vector of log-likelihoods (method="lambda"
only).
a phylogenetic tree in "phylo"
format.
vector containing the single independent variable (e.g., size), or matrix with multiple independent variables in columns.
vector or matrix with one or multiple dependent variables in columns.
method to obtain the correlation structure: can be "BM"
or "lambda"
.
Liam Revell liam.revell@umb.edu
This function fits one or multiple phylogenetic regressions (depending on the number of columns in Y
) and computes the residuals. Designed for phylogenetic size correction using GLS regression (e.g., Revell 2009).
Optionally fits \(\lambda\) for each regression model. Likelihood optimization of \(\lambda\) is performed for method=
"lambda"
using optimize
on the interval (0,1).
This function is theoretically redundant with residuals
applied to a "gls"
object class in which the correlation structure is based on corBrownian
or corPagel
; however some users may find this method simpler, and it provides a good way to cross-check your results & make sure that you are using gls
correctly.
Revell, L. J. (2009) Size-correction and principal components for interspecific comparative studies. Evolution, 63, 3258-3268.
Revell, L. J. (2010) Phylogenetic signal and linear regression on species data. Methods in Ecology and Evolution, 1, 319-329.
Revell, L. J. (2024) phytools 2.0: an updated R ecosystem for phylogenetic comparative methods (and other things). PeerJ, 12, e16505.
phyl.pca
, gls