Learn R Programming

aphylo (version 0.3-3)

balance_ann: Functional balance of a tree

Description

This function computes the distance between .5 and the observed proportion of ones for each function in a tree.

Usage

balance_ann(phy)

Value

If phy is an object of class phylo, a single scalar, otherwise, it returns a vector of length Ntrees(phy).

Arguments

phy

An object of class aphylo or multiAphylo

Details

Functional balance is defined as follows

$$% P^{-1}\sum_{p}\left(1 - \left|0.5 - N^{-1}\sum_n a_{np}\right|\right) $$

Where A is the matrix of annotations.

With values ranging between 0 and 1, one been perfect balance, this is, equal number of zeros and ones in the annotations. In the case of multiple functions, as noted in the formula, the balance is the average across functions.

Examples

Run this code
x <- raphylo(20, P = 2)
balance_ann(x)

balance_ann(c(x, x))

Run the code above in your browser using DataLab