clade_discrete: Influential Clade Detection - Trait Evolution Discrete...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/clade_Discrete.R

Description

Fits models for trait evolution of discrete (binary) characters, detecting influential clades

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
clade_discrete(
  data,
  phy,
  model,
  transform = "none",
  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 Mkn model to use (see Details).

transform

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

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 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

Details

This function sequentially removes one clade at a time, fits a model of discrete character evolution using fitDiscrete, repeats this this many times (controlled by n.sim), stores the results and calculates the effects on model parameters. Currently, only binary discrete 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 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.

Value

The function tree_discrete returns a list with the following components:

call: The function call

data: The original full data frame.

full.model.estimates: Parameter estimates (transition rates q12 and q21), AICc and the optimised value of the phylogenetic transformation parameter (e.g. lambda) for the full model without deleted clades.

sensi.estimates: Parameter estimates (transition rates q12 and q21),(percentual) difference in parameter estimate compared to the full model (DIFq12, sigsq.q12, DIFq21, optpar.q21), AICc and the optimised value of the phylogenetic transformation parameter (e.g. lambda) 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.)

Author(s)

Gijsbert Werner & Gustavo Paterno

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Not run: 
#Load data:
data("primates")
#Create a binary trait factor 
primates$data$adultMass_binary<-ifelse(primates$data$adultMass > 7350, "big", "small")
clade_disc<-clade_discrete(data=primates$data,phy = primates$phy[[1]],model="SYM",
trait.col = "adultMass_binary",clade.col="family",n.sim=30,n.species=10,n.cores = 2)
summary(clade_disc)
sensi_plot(clade_disc)
sensi_plot(clade_disc, clade = "Cebidae", graph = "q12")
#Change the evolutionary model, tree transformation or minimum number of species per clade
clade_disc_2<-clade_discrete(data=primates$data,phy = primates$phy[[1]],
model="ARD",transform="kappa",
trait.col = "adultMass_binary",clade.col="family",n.sim=30,
n.species=8,n.cores = 2)
summary(clade_disc_2)
sensi_plot(clade_disc_2)
sensi_plot(clade_disc_2, graph = "q12")
sensi_plot(clade_disc_2, graph = "q21")

## End(Not run)

sensiPhy documentation built on April 14, 2020, 7:15 p.m.