Learn R Programming

windex (version 2.1.0)

pir: Calculates phylogenetic imbalance ratio (PIR)

Description

Calculates the PIR to assess suitability of categorical traits for modelling approaches, following Gardner and Organ (2021).

Usage

pir(tree,trait1,trait2=NULL)

Value

CI

Consistency index

NIR

Normalised imbalance ratio (a measure of class imbalance across states or, if there are two traits, state combinations)

PIR

Phylogenetic imbalance ratio

Arguments

tree

Phylogenetic tree of class 'phylo'.

trait1

Named vector containing states of a categorical trait. Must be a character or a factor and names must match tip labels of the tree.

trait2

An optional second trait when the intention is to test suitability of modelling a correlation between two categorical traits. Argument requirements are the same as trait1.

Author

Kevin Arbuckle

References

Gardner, J.D. and Organ, C.L. 2021. Evolutionary sample size and consilience in phylogenetic comparative analysis. Systematic Biology 70:1061 - 1075.

Examples

Run this code
data(sample.tree)

# Single trait (perhaps intended for estimating transition rates)
t1<-sample(c("brown","blue","green"),length(sample.tree$tip.label),replace=TRUE)
names(t1)<-sample.tree$tip.label
pir(sample.tree,trait1=t1)

# Two traits (perhaps intended for testing correlations)
t2<-sample(c("0","1"),length(sample.tree$tip.label),replace=TRUE)
names(t2)<-sample.tree$tip.label
pir(sample.tree,trait1=t1,trait2=t2)

Run the code above in your browser using DataLab