Learn R Programming

sensiPhy (version 0.8.5)

tree_discrete: Phylogenetic uncertainty - Trait Evolution Discrete Characters

Description

Fits models for trait evolution of discrete (binary) characters, evaluating phylogenetic uncertainty.

Usage

tree_discrete(
  data,
  phy,
  n.tree = 10,
  model,
  transform = "none",
  bounds = list(),
  n.cores = NULL,
  track = TRUE,
  ...
)

Arguments

data

Data vector for a single binary trait, with names matching tips in phy.

phy

Phylogenies (class 'multiPhylo', see ?ape).

n.tree

Number of times to repeat the analysis with n different trees picked randomly in the multiPhylo file. If NULL, n.tree = 10

model

The Mkn model to use (see Details).

transform

The evolutionary model to transform the tree (see Details). Default is none.

bounds

settings to constrain parameter estimates. See fitDiscrete

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 fitDiscrete

Value

The function tree_discrete returns a list with the following components:

call: The function call

data: The original full data vector

sensi.estimates: Parameter estimates (transition rates q12 and q21), AICc and the optimised value of the phylogenetic transformation parameter (e.g. lambda) for each analysis with a different phylogenetic tree.

N.tree: Number of trees n.tree analysed

stats: Main statistics for model parameters, i.e. minimum, maximum, mean, median and sd-values

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

Details

This function fits different models of discrete character evolution using fitDiscrete to n trees, randomly picked in a multiPhylo file. Currently, only binary discrete traits are supported

Different character model from fitDiscrete can be used, including ER (equal-rates), SYM (symmetric), ARD (all-rates-different) and meristic (stepwise fashion).

All transformations to the phylogenetic tree from fitDiscrete can be used, i.e. none, EB, lambda, kappa anddelta.

See fitDiscrete for more details on character models and tree transformations.

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

fitDiscrete

Examples

Run this code
# NOT RUN {
#Load data:
data("primates")
#Create a binary trait factor 
adultMass_binary<-ifelse(primates$data$adultMass > 7350, "big", "small")
adultMass_binary<-as.factor(as.factor(adultMass_binary))
names(adultMass_binary)<-rownames(primates$data)
#Model trait evolution accounting for phylogenetic uncertainty
tree_binary<-tree_discrete(data = adultMass_binary,phy = primates$phy,
model = "ARD",transform = "none",n.tree = 30,n.cores = 2,track = TRUE)
#Print summary statistics
summary(tree_binary)
sensi_plot(tree_binary)
sensi_plot(tree_binary,graphs="q12")
sensi_plot(tree_binary,graphs="q21")
#Use a different evolutionary model or transformation.
tree_binary_lambda<-tree_discrete(data = adultMass_binary,phy = primates$phy,
model = "SYM",transform = "lambda",n.tree = 30,n.cores = 2,track = TRUE)
summary(tree_binary_lambda) #Using Pagel's Lambda
sensi_plot(tree_binary_lambda)  
#Symmetrical rates, with an Early Burst (EB) model of trait evolution
tree_binary_SYM_EB<-tree_discrete(data = adultMass_binary,phy = primates$phy,
model = "SYM",transform = "EB",n.tree = 30,n.cores = 2,track = TRUE)
summary(tree_binary_SYM_EB)
sensi_plot(tree_binary_SYM_EB) 
sensi_plot(tree_binary_SYM_EB,graphs="optpar") 
# }

Run the code above in your browser using DataLab