Search in sources :

Example 1 with YuleModel

use of beast.evolution.speciation.YuleModel in project beast2 by CompEvol.

the class YuleModelTest method testYule.

@Test
public void testYule() throws Exception {
    YuleModel bdssm = new YuleModel();
    Tree tree1 = new TreeParser("((A:1.0,B:1.0):1.0,C:2.0);", false);
    bdssm.setInputValue("tree", tree1);
    bdssm.setInputValue("birthDiffRate", new RealParameter("10."));
    bdssm.setInputValue("originHeight", new RealParameter("10."));
    bdssm.initAndValidate();
    double logP1 = bdssm.calculateTreeLogLikelihood(tree1);
    Tree tree = new TreeParser("((A:1.0,B:1.0):2.0,C:3.0);", false);
    bdssm.setInputValue("tree", tree);
    bdssm.setInputValue("birthDiffRate", new RealParameter("10."));
    bdssm.setInputValue("originHeight", new RealParameter("10."));
    bdssm.initAndValidate();
    double logP2 = bdssm.calculateTreeLogLikelihood(tree);
    assertEquals(logP1 - logP2, 10.0);
}
Also used : TreeParser(beast.util.TreeParser) Tree(beast.evolution.tree.Tree) RealParameter(beast.core.parameter.RealParameter) YuleModel(beast.evolution.speciation.YuleModel) Test(org.junit.Test)

Aggregations

RealParameter (beast.core.parameter.RealParameter)1 YuleModel (beast.evolution.speciation.YuleModel)1 Tree (beast.evolution.tree.Tree)1 TreeParser (beast.util.TreeParser)1 Test (org.junit.Test)1