Search in sources :

Example 21 with Statistic

use of dr.inference.model.Statistic in project beast-mcmc by beast-dev.

the class DistributionLikelihoodParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    final XMLObject cxo = xo.getChild(DISTRIBUTION);
    ParametricDistributionModel model = (ParametricDistributionModel) cxo.getChild(ParametricDistributionModel.class);
    DistributionLikelihood likelihood = new DistributionLikelihood(model);
    XMLObject cxo1 = xo.getChild(DATA);
    final int from = cxo1.getAttribute(FROM, -1);
    int to = cxo1.getAttribute(TO, -1);
    if (from >= 0 || to >= 0) {
        if (to < 0) {
            to = Integer.MAX_VALUE;
        }
        if (!(from >= 0 && to >= 0 && from < to)) {
            throw new XMLParseException("ill formed from-to");
        }
        likelihood.setRange(from, to);
    }
    for (int j = 0; j < cxo1.getChildCount(); j++) {
        if (cxo1.getChild(j) instanceof Statistic) {
            likelihood.addData((Statistic) cxo1.getChild(j));
        } else {
            throw new XMLParseException("illegal element in " + cxo1.getName() + " element");
        }
    }
    return likelihood;
}
Also used : Statistic(dr.inference.model.Statistic) ParametricDistributionModel(dr.inference.distribution.ParametricDistributionModel) DistributionLikelihood(dr.inference.distribution.DistributionLikelihood)

Aggregations

Statistic (dr.inference.model.Statistic)21 Taxa (dr.evolution.util.Taxa)2 DistributionLikelihood (dr.inference.distribution.DistributionLikelihood)2 ParametricDistributionModel (dr.inference.distribution.ParametricDistributionModel)2 SumStatistic (dr.inference.model.SumStatistic)2 Tree (dr.evolution.tree.Tree)1 Taxon (dr.evolution.util.Taxon)1 TaxonList (dr.evolution.util.TaxonList)1 CalibrationPoints (dr.evomodel.speciation.CalibrationPoints)1 SpeciationLikelihood (dr.evomodel.speciation.SpeciationLikelihood)1 SpeciationModel (dr.evomodel.speciation.SpeciationModel)1 DateParser (dr.evoxml.DateParser)1 TaxaParser (dr.evoxml.TaxaParser)1 TaxonParser (dr.evoxml.TaxonParser)1 EmpiricalDistributionLikelihood (dr.inference.distribution.EmpiricalDistributionLikelihood)1 MixedDistributionLikelihood (dr.inference.distribution.MixedDistributionLikelihood)1 SplineInterpolatedLikelihood (dr.inference.distribution.SplineInterpolatedLikelihood)1 Bounds (dr.inference.model.Bounds)1 CoulombPrior (dr.inference.model.CoulombPrior)1 DifferenceStatistic (dr.inference.model.DifferenceStatistic)1