Learn R Programming

phylolm (version 2.0)

phylolm: Phylogenetic Linear Model

Description

Fits a phylogenetic linear regression model. The likelihood is calculated with an algorithm that is linear in the number of tips in the tree.

Usage

phylolm(formula, data = list(), phy, model = c("BM", "OUrandomRoot",
       "OUfixedRoot", "lambda", "kappa", "delta", "EB", "trend"),
       lower.bound = NULL, upper.bound = NULL, 
       starting.value = NULL, ...)

Arguments

formula
a model formula.
data
a data frame containing variables in the model. If not found in data, the variables are taken from current environment.
phy
a phylogenetic tree of type phylo with branch lengths.
model
a model for the covariance (see Details).
lower.bound
optional lower bound for the optimization of the phylogenetic model parameter.
upper.bound
optional upper bound for the optimization of the phylogenetic model parameter.
starting.value
optional starting value for the optimization of the phylogenetic model parameter.
...
further arguments to be passed to the function optim.

Value

  • coefficientsthe named vector of coefficients.
  • sigma2the maximum likelihood estimate of the variance rate sigma square.
  • optparthe optimized value of the phylogenetic correlation parameter (alpha, lambda, kappa, delta or rate).
  • logLikthe maximum of the log likelihood.
  • pthe number of all parameters of the model.
  • aicAIC value of the model.
  • vcovcovariance matrix for the regression coefficients, given the phylogenetic correlation parameter (if any).
  • fitted.valuesfitted values.
  • residualsraw residuals.
  • yresponse.
  • nnumber of observations (tips in the tree).
  • dnumber of dependent variables.
  • formulathe model formula.
  • callthe original call to the function.
  • modelthe phylogenetic model for the covariance.

encoding

latin1

Details

This function uses an algorithm that is linear in the number of tips in the tree to calculate the likelihood. Possible phylogenetic models for the error term are the Brownian motion model (BM), the Ornstein-Uhlenbeck model with an ancestral state to be estimated at the root (OUfixedRoot), the Ornstein-Uhlenbeck model with the ancestral state at the root having the stationary distribution (OUrandomRoot), Pagel's lambda model (lambda), Pagel's kappa model (kappa), Pagel's delta model (delta), the Early Burst model (EB), and the Brownian motion model with a trend (trend).

References

Ho, L. S. T. and An�, C. "A linear-time algorithm for Gaussian and non-Gaussian trait evolution models". Systematic Biology in review.

Butler, M. A. and King, A. A. 2004. "Phylogenetic comparative analysis: A modeling approach for adaptive evolution". The American Naturalist 164:683-695.

Hansen, T. F. 1997. "Stabilizing selection and the comparative analysis of adaptation". Evolution 51:1341-1351.

Harmon, L. J. et al. 2010. "Early bursts of body size and shape evolution are rare in comparative data". Evolution 64:2385-2396.

Ho, L. S. T. and An�, C. "Asymptotic theory with hierarchical autocorrelation: Ornstein-Uhlenbeck tree models". The Annals of Statistics 41(2):957-981.

Pagel, M. 1997. "Inferring evolutionary processes from phylogenies". Zoologica Scripta 26:331-348.

Pagel, M. 1999. "Inferring the historical patterns of biological evolution". Nature 401:877-884.

See Also

corBrownian, corMartins, corPagel, fitContinuous, pgls.

Examples

Run this code
set.seed(321123)
tre = rcoal(50)
taxa = sort(tre$tip.label)
b0=0; b1=1;
x = rTrait(phy=tre,model="BM",
             parameters=list(ancestral.state=0,sigma2=10))
y  = b0 + b1*x + 
     rTrait(phy=tre,model="lambda",parameters=list(
              ancestral.state=0,sigma2=1,lambda=0.5))
dat = data.frame(trait=y[taxa],pred=x[taxa])
fit = phylolm(trait~pred,data=dat,phy=tre,model="lambda")
summary(fit)

Run the code above in your browser using DataLab