Learn R Programming

CollessLike (version 2.0)

indices.simulation: Generates random trees and compute their balance indices

Description

Generates a list of trees according to the introduced parameters for the alpha-gamma model. Then, this 3 balance index are calulated: Colless-like, Sackin and Cophenetic.

Usage

indices.simulation(n, alpha = NA, gamma = NA, repetitions = 1000,
  norm = FALSE)

Arguments

n

the number of leaves of the tree.

alpha

parametrer of the alpha-gamma model, between 0 and 1.

gamma

parametrer of the alpha-gamma model, between 0 and alpha.

repetitions

the number of trees to generate.

norm

a logical object indicating if the indices should been normalized or not.

Value

A 3-column data.frame with the Colless-like, Sackin and Cophenetic balance indices for every generated tree. If more than one data.frame has to be generated, then the returned value is a data.frame list (its names specify which alpha and gamma parameters have generated that data.frame, for instance "a0.5g0.3" indicates alpha=0.5 and gamma=0.3).

Details

Given a number of leaves, the function generates a tree with that number of leaves and computates the three indeces of balance (Colles-like, Sackin and Cophenetic with function balance.indices). This is done as many times as it is set by 'repetitions' parameter, and it generates a 3-column data.frame of indices.

The trees are generated according to the alpha-gamma model. These parameters can be specified by alpha and gamma parameters of the function. The following cases are distinguished:

  • alpha = NA and gamma = NA : All the 66 combinations of alpha in { 0, 0.1, 0.2, ... ,0.9, 1 } and gamma in { 0, 0.1, ... ,alpha } are done.

  • alpha in [0,1] and gamma = NA : Since alpha is fixed, all the combinations with that alpha and gamma in { 0, 0.1, ... ,alpha } are done.

  • alpha in [0,1] and gamma in [0,alpha] : Both parameters are fixed. Then, only that combination is done.

References

B. Chen, D. Ford, M. Winkel, A new family of Markov branching trees: the alpha-gamma model. Electr. J. Probab. 14 (2009), 400-430.

A. Mir, F. Rossello, L.Rotger, Sound Colless-like balance indices for multifurcating phylogenetic trees.PloS ONE 13 (2018), e0203401.

A. Mir, F. Rossello, L.Rotger, A new balance index for phylogenetic trees. Mathematical Biosciences 241 (2013), 125-136.

M. J. Sackin, "Good" and "bad" phenograms. Sys. Zool, 21 (1972), 225-226.

See Also

balance.indices

Examples

Run this code
# NOT RUN {
#('Repetitions' set as 100 for a fast example)
# }
# NOT RUN {
indices.table = indices.simulation(5,0.5,0.3,repetitions=10)
# }
# NOT RUN {
head(indices.table)
# }
# NOT RUN {
#Normalized indices (between 0 and 1)
# }
# NOT RUN {
indices.table = indices.simulation(5,0.5,0.3,repetitions=10,norm=TRUE)
# }
# NOT RUN {
head(indices.table)
# }
# NOT RUN {
#Without specifying alpha and gamma
# }
# NOT RUN {
indices.list = indices.simulation(5,repetitions=100)
# }
# NOT RUN {
#by default alpha=seq(0,1,0.1) and gamma=seq(0,alpha,0.1), thus
# }
# NOT RUN {
length(indices.list) #=66
# }
# NOT RUN {
#all the elements of the list have a name that identifies its parameters
# }
# NOT RUN {
indices.list$a0.5g0.3
# }
# NOT RUN {
indices.list$a0.7g0.2
# }
# NOT RUN {
 
# }

Run the code above in your browser using DataLab