Learn R Programming

phylolm (version 2.0)

phyloglm: Phylogenetic Generalized Linear Model

Description

Fits a phylogenetic generalized linear model. The computation uses an algorithm that is linear in the number of tips in the tree.

Usage

phyloglm(formula, data = list(), phy, model = c("LogReg"), 
                  btol = 10, log.alpha.bound = 4)

Arguments

formula
a model formula.
data
a data frame containing variables in the model. If not found in data, the variables are taken from the current environment.
phy
a phylogenetic tree of type phylo with branch lengths.
model
Currently, only phylogenetic logistic regression is implemented.
btol
bound on the linear predictor to bound the searching space.
log.alpha.bound
bound for the log of the parameter alpha.

Value

  • coefficientsthe named vector of coefficients.
  • alphathe phylogenetic correlation parameter.
  • sdstandard deviation for the regression coefficients, given the phylogenetic correlation parameter.
  • vcovcovariance matrix for the regression coefficients, given the phylogenetic correlation parameter.
  • 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.

References

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

Ives, A. R. and T. Garland, Jr. 2010. "Phylogenetic logistic regression for binary dependent variables". Systematic Biology 59:9-26.

Examples

Run this code
set.seed(123456)
tre = rtree(50)
x = rTrait(phy=tre)
X = cbind(rep(1,50),x)
y = rbinTrait(phy=tre, beta=c(-1,0.5), alpha=1 ,X=X)
dat = data.frame(trait01 = y, predictor = x)
fit = phyloglm(trait01~predictor,phy=tre,data=dat)
summary(fit)
coef(fit)
vcov(fit)

Run the code above in your browser using DataLab