Last data update: 2014.03.03

R: Compute the pairwise correlation in rate regimes between all...
getCohortMatrixR Documentation

Compute the pairwise correlation in rate regimes between all tips in a bammdata object

Description

Takes a bammdata object and computes the pairwise correlation in evolutionary rate regimes between all tips in the phylogeny. This can be used to identify cohorts of taxa that share common macroevolutionary rate parameters. It can also be used to construct a correlation matrix for GLS analyses using BAMM-estimated tip rates of speciation, extinction, or phenotypic evolution.

Usage

getCohortMatrix(ephy)

Arguments

ephy

An object of class bammdata.

Details

The cohort matrix is important for interpreting and visualizing macroevolutionary dynamics. Each entry [i, j] of the cohort matrix is the probability that taxon i and taxon j share a common macroevolutionary rate regime. To compute this, we simply tabulate the percentage of samples from the posterior where taxon i and taxon j were placed in the same rate regime. If there is no rate heterogeneity in the dataset (e.g., the data are best explained by a single rate regime), then all species will tend to share the same rate regime and all values of the cohort matrix will approach 1.

A value of 0 between any two taxa means that at least one rate shift occurred on the nodal path connecting them in 100% of samples from the posterior. A value of 0.50 would imply that 50% of samples from the posterior included a rate shift on the path connecting taxa i and j. See below (Examples) for an illustration of this.

Value

A numeric matrix of dimension k x k, where k is the number of species in the phylogeny included in the bammdata object. Species names are included as row names and column names. The matrix is symmetric, such that the values for entry [i , j] will mirror those for [j , i].

Author(s)

Dan Rabosky

References

http://bamm-project.org

Examples

data(whales, events.whales)
ed <- getEventData(whales, events.whales, nsamples=500)

cormat <- getCohortMatrix(ed)

dim(cormat)
hist(cormat, breaks=50)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BAMMtools)
Loading required package: ape
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/BAMMtools/getCohortMatrix.Rd_%03d_medium.png", width=480, height=480)
> ### Name: getCohortMatrix
> ### Title: Compute the pairwise correlation in rate regimes between all
> ###   tips in a 'bammdata' object
> ### Aliases: getCohortMatrix
> ### Keywords: models
> 
> ### ** Examples
> 
> data(whales, events.whales)
> ed <- getEventData(whales, events.whales, nsamples=500)
Processing event data from data.frame

Discarded as burnin: GENERATIONS <  0
Analyzing  500  samples from posterior

Setting recursive sequence on tree...

Done with recursive sequence

> 
> cormat <- getCohortMatrix(ed)
> 
> dim(cormat)
[1] 87 87
> hist(cormat, breaks=50)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>