PGLS_fossil: Phylogenetic Generalized Least Square with fossil phylogenies

View source: R/PGLS_fossil.R

PGLS_fossilR Documentation

Phylogenetic Generalized Least Square with fossil phylogenies

Description

The function performs pgls for non-ultrametric trees using either Pagel's lambda transform, Brownian Motion or RRphylo rates to change the correlation structure.

Usage

PGLS_fossil(modform,data,tree,RR=NULL)

Arguments

modform

the formula for the regression model.

data

a list of named vectors including response and predictor variables as named in modform.

tree

a phylogenetic tree. The tree needs not to be ultrametric and fully dichotomous.

RR

the result of RRphylo performed on the response variable. If NULL the function fits Pagel's lambda in the regression for univariate data or uses the tree variance covariance matrix in the multivariate case. If RR is specified, tree branches are rescaled to the absolute branch-wise rate values calculated by RRphylo to transform the variance-covariance matrix.

Details

With univariate data, the user may want to use either Pagel's lambda or RRphylo rates to transform the correlation structure. In the former case, the lambda transform is fitted to the data (Revell, 2010). In the latter case, branch lengths are multiplied by absolute rates as computed by RRphylo to accommodate rate variation across the tree. In the multivariate case, the variance-covariance structure is either left unaltered by keeping RR = NULL (Adams and Collyer, 2015) or changed according to the norm-2 vector of rates computed for each phenotype by specifying the RR object.

Value

Fitted pgls parameters and significance.

Author(s)

Pasquale Raia, Silvia Castiglione, Carmela Serio, Alessandro Mondanaro, Marina Melchionna, Mirko Di Febbraro, Antonio Profico, Francesco Carotenuto

References

Revell, L.J. (2010). Phylogenetic signal and linear regression on species data. Methods in Ecology and Evolution, 1, 319-329. https://doi.org/10.1111/j.2041-210X.2010.00044.x

Adams, D.C., & Collyer, M. L. (2017). Multivariate phylogenetic comparative methods: evaluations, comparisons, and recommendations. Systematic Biology, 67, 14-31. https://doi.org/10.1093/sysbio/syx055

See Also

RRphylo vignette

Examples

## Not run: 
library(ape)
library(phytools)

rtree(100)->tree
fastBM(tree)->resp
fastBM(tree,nsim=3)->resp.multi
fastBM(tree)->pred1
fastBM(tree)->pred2

PGLS_fossil(modform=y1~x1+x2,data=list(y1=resp,x2=pred1,x1=pred2),tree=tree)->pgls_noRR

RRphylo::RRphylo(tree,resp)->RR
PGLS_fossil(modform=y1~x1+x2,data=list(y1=resp,x2=pred1,x1=pred2),tree=tree,RR=RR)->pgls_RR

# To derive log-likelihood and AIC for PGLS_fossil outputs performed on univariate data
# without including the RR object, the function AIC can be applied
AIC(pgls_noRR)

# For univarite with RR and multivariate models, the function "model.comparison"
# from the package RRPP must be used.
RRPP::model.comparison(pgls_RR,type = "logLik")

PGLS_fossil(modform=y1~x1+x2,data=list(y1=resp.multi,x2=pred1,x1=pred2),tree=tree)->pgls2_noRR
cc<- 2/parallel::detectCores()
RRphylo::RRphylo(tree,resp.multi,clus=cc)->RR
PGLS_fossil(modform=y1~x1+x2,data=list(y1=resp.multi,x2=pred1,x1=pred2),tree=tree,RR=RR)->pgls2_RR

RRPP::model.comparison(pgls2_noRR,pgls2_RR,type = "logLik")


## End(Not run)

RRphylo documentation built on May 9, 2022, 9:08 a.m.