Search in sources :

Example 6 with LogNormalDistributionModel

use of beast.math.distributions.LogNormalDistributionModel in project beast2 by CompEvol.

the class LogNormalDistributionModelTest method testCalcLogP2.

@Test
public void testCalcLogP2() throws Exception {
    // does the same as testCalcLogP(), but with by constructing object through XML
    String xml = "<input spec='beast.math.distributions.LogNormalDistributionModel' " + "offset='1200' " + "M='2000' " + "S='0.6' " + "meanInRealSpace='true'/>";
    RealParameter p = new RealParameter(new Double[] { 2952.6747000000014 });
    XMLParser parser = new XMLParser();
    LogNormalDistributionModel logNormal = (LogNormalDistributionModel) parser.parseBareFragment(xml, true);
    double f0 = logNormal.calcLogP(p);
    assertEquals(-7.880210654973873, f0, 1e-10);
}
Also used : LogNormalDistributionModel(beast.math.distributions.LogNormalDistributionModel) RealParameter(beast.core.parameter.RealParameter) XMLParser(beast.util.XMLParser) Test(org.junit.Test)

Aggregations

LogNormalDistributionModel (beast.math.distributions.LogNormalDistributionModel)6 Test (org.junit.Test)5 RealParameter (beast.core.parameter.RealParameter)3 XMLParser (beast.util.XMLParser)1