likelihood.test {apTreeshape} | R Documentation |
likelihood.test
uses the shape.statistic
to perform a test on tree data for the Yule vs PDA model hypothesis. The test is based on a Gaussian approximation of the ratio of likelihood.
likelihood.test(tree, model = "yule", alternative="two.sided")
tree |
An object of class "treeshape" on which the test is performed. |
model |
The null hypothesis of the test. It must be equal to one of the two character strings "yule" or "pda" . |
alternative |
A character string specifying the alternative hypothesis of the test. Must be one of "two.sided" (default), "less" or "greater" . |
A test on tree data that rejects either the Yule of PDA model. The test is based on the ratio of the likelihood of the PDA model to the likelihood of the Yule model (shape.statistic). The less balanced the tree is and the larger its shape statistic. The alternative "less" should be used to test whether the tree is less unbalanced than predicted by the null model. The alternative "greater" should be used to test whether the tree is more unbalanced than predicted by the null model.
Under the Yule model, the test statistic has approximate Gaussian distribution of mean = 1.204*n-log(n-1)-2 and variance = 0.168*n-0.710, where n is the number of tips of the tree. The Gaussian approximation is accurate for n greater than 20.
Under the PDA model, the test statistic has approximate Gaussian distribution of mean ~ 2.03*n-3.545*sqrt(n-1) and variance ~ 2.45*(n-1)*log(n-1), where n is the number of tips of the tree. The Gaussian approximation is accurate for very large n (n greater than 10000(?)). The test uses tabulated empirical values of variances estimated from Monte Carlo simulations. The test uses the formula: variance ~ 1.570*n*log(n)-5.674*n+3.602*sqrt(n)+14.915
The values of the means and variances have been obtained from an analogy with binary search tree models in computer science.
likelihood.test
returns a list which includes:
model |
the null model used by the test |
statistic |
the test statistic |
p.value |
the p.value of the test |
alternative |
the alternative hypothesis of the test |
Michael Blum <michael.blum@imag.fr>
Nicolas Bortolussi <nicolas.bortolussi@imag.fr>
Eric Durand <eric.durand@imag.fr>
Olivier François <olivier.francois@imag.fr>
Fill, J. A. (1996), On the Distribution of Binary Search Trees under the Random Permutation Model. Random Structures and Algorithms, 8, 1 – 25.
## Generate a Yule tree with 150 tips. Is it likely to be fitting the PDA model? likelihood.test(ryule(150),model="pda") ## The p.value is close from 0. We reject the PDA hypothesis. ## Test on the Carnivora tree: is it likely to be fitting the Yule model? data(carnivora.treeshape) likelihood.test(carnivora.treeshape) ## The p.value is high, so it's impossible to reject the Yule hypothesis.