Learn R Programming

sensiPhy (version 0.8.4)

clade_continuous: Influential Clade Detection - Trait Evolution Continuous Characters

Description

Fits models for trait evolution of continuous characters, detecting influential clades

Usage

clade_continuous(
  data,
  phy,
  model,
  trait.col,
  clade.col,
  n.species = 5,
  n.sim = 20,
  bounds = list(),
  n.cores = NULL,
  track = TRUE,
  ...
)

Arguments

data

Data frame containing species traits with row names matching tips in phy.

phy

A phylogeny (class 'phylo') matching data.

model

The evolutionary model (see Details).

trait.col

The column in the provided data frame which specifies the trait to analyse (which should be a factor with two level)

clade.col

The column in the provided data frame which specifies the clades (a character vector with clade names).

n.species

Minimum number of species in a clade for the clade to be included in the leave-one-out deletion analysis. Default is 5.

n.sim

Number of simulations for the randomization test.

bounds

settings to constrain parameter estimates. See fitContinuous

n.cores

number of cores to use. If 'NULL', number of cores is detected.

track

Print a report tracking function progress (default = TRUE)

...

Further arguments to be passed to fitContinuous

Value

The function tree_continuous returns a list with the following components:

call: The function call

data: The original full data frame.

full.model.estimates: Parameter estimates (rate of evolution sigsq and where applicable optpar), root state z0, AICc for the full model without deleted clades.

sensi.estimates: Parameter estimates (sigsq and optpar), (percentual) difference in parameter estimate compared to the full model (DIFsigsq, sigsq.perc, DIFoptpar, optpar.perc), AICc and z0 for each repeat with a clade removed.

null.dist: A data frame with estimates for the null distributions for all clades analysed.

errors: Clades where deletion resulted in errors.

clade.col: Which column was used to specify the clades?

optpar: Transformation parameter used (e.g. lambda, kappa etc.)

Details

This function sequentially removes one clade at a time, fits a model of continuous character evolution using fitContinuous, repeats this many times (controlled by n.sim), stores the results and calculates the effects on model parameters Currently, only binary continuous traits are supported.

Additionally, to account for the influence of the number of species on each clade (clade sample size), this function also estimates a null distribution expected for the number of species in a given clade. This is done by fitting models without the same number of species as in the given clade.The number of simulations to be performed is set by 'n.sim'. To test if the clade influence differs from the null expectation for a clade of that size, a randomization test can be performed using 'summary(x)'.

Different evolutionary models from fitContinuous can be used, i.e. BM,OU, EB, trend, lambda, kappa, delta and drift.

See fitContinuous for more details on evolutionary models.

Output can be visualised using sensi_plot.

References

Paterno, G. B., Penone, C. Werner, G. D. A. sensiPhy: An r-package for sensitivity analysis in phylogenetic comparative methods. Methods in Ecology and Evolution 2018, 9(6):1461-1467

Yang Z. 2006. Computational Molecular Evolution. Oxford University Press: Oxford.

Harmon Luke J, Jason T Weir, Chad D Brock, Richard E Glor, and Wendell Challenger. 2008. GEIGER: investigating evolutionary radiations. Bioinformatics 24:129-131.

See Also

fitContinuous

Examples

Run this code
# NOT RUN {
data("primates")
#Model trait evolution accounting for phylogenetic uncertainty
clade_cont<-clade_continuous(data=primates$data,phy = primates$phy[[1]], model="OU",
trait.col = "adultMass",clade.col="family",n.sim=30,n.species=10,n.cores = 2,track=TRUE)
#Print summary statistics
summary(clade_cont)
sensi_plot(clade_cont,graph="all")
sensi_plot(clade_cont,clade="Cercopithecidae",graph = "sigsq")
sensi_plot(clade_cont,clade="Cercopithecidae",graph = "optpar")
#Change the evolutionary model, tree transformation or minimum number of species per clade
clade_cont2<-clade_continuous(data=primates$data,phy = primates$phy[[1]],model="delta",
trait.col = "adultMass",clade.col="family",n.sim=30,n.species=5,n.cores = 2,track=TRUE)
summary(clade_cont2)
sensi_plot(clade_cont2)
clade_cont3<-clade_continuous(data=primates$data,phy = primates$phy[[1]],model="BM",
trait.col = "adultMass",clade.col="family",n.sim=30,n.species=5,n.cores = 2,track=TRUE)
summary(clade_cont3)
sensi_plot(clade_cont3,graph="sigsq")
# }

Run the code above in your browser using DataLab