gamStat.batch {laser}R Documentation

Compute Gamma Statistic For Batch of Branching Times

Description

Takes a matrix or dataframe of branching times obtained from a set of phylogenies using getBtimes.batch and performs the MCCR test of Pybus and Harvey (2000). Can also be used to generate the posterior distribution of the gamma statistic for Bayesian inference.

Usage

gamStat.batch(x, stat = NULL)

Arguments

x a matrix or dataframe containing branching times for phylogenies
stat value of the gamma statistic for the test phylogeny

Details

'x' is obtained through use of getBtimes.batch.

'stat' is the calculated value of the gamma statistic you wish to compare to the null distribution for a given level of sampling and number of tips. If stat = NULL (the default), the function returns a list with calculated gamma statistics for each set of branching times, as well as the critical value of the distribution (alpha = 0.05). Observed gamma statistic values less than the critical value have probability < 0.05 under the null hypothesis that rates have not decreased over time. If stat is specified, the function will determine the p-value of the observed value under the null hypothesis by tabulating the number of simulated values above and below the observed value.

Value

a list with the following components:

gamstat a vector of calculated gamma statistics for the matrix of branching times
gamcrit the critical value of the distribution specified by the simulated trees (alpha = 0.05)
pval the Type I error probability of the observed value under the null distribution specified by the input data x

Note

This performs the MCCR test of Pybus and Harvey (2000). However, you must generate phylogenies under a rate-constant pure-birth (Yule) model using either Phyl-O-Gen (http://evolve.zoo.ox.ac.uk/software/PhyloGen/main.html) or another program.

This function can also be used for Bayesian inference. For example, you can tabulate the distribution of the gamma statistic from the posterior distribution of phylogenetic trees sampled using MCMC or MCMCMC.

Author(s)

Dan Rabosky DLR32@cornell.edu

References

Pybus, O. G., and P. H. Harvey. 2000. Testing macro-evolutionary models using incomplete molecular phylogenies. Proc. R. Soc. Lond. Biol. B 267:2267-2272.

See Also

gamStat, getBtimes.batch, fitdAICrc.batch

Examples


data("rtrees50")
  write.table(rtrees50, file = 'temp.txt', quote=FALSE, 
                row.names = FALSE, col.names = FALSE)
#generates file 'temp.txt' with data formatted appropriately 
intrees <- getBtimes.batch(file = 'temp.txt')
result <- gamStat.batch(intrees)
hist(result$gamstat)
result$gamcrit
unlink('temp.txt') #delete temp file


[Package laser version 1.0 Index]