Search in sources :

Example 1 with GMRFSkyrideLikelihood

use of dr.evomodel.coalescent.GMRFSkyrideLikelihood in project beast-mcmc by beast-dev.

the class GMRFIntervalHeightsStatisticParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    String name = xo.getAttribute(Statistic.NAME, xo.getId());
    GMRFSkyrideLikelihood skyrideLikelihood = (GMRFSkyrideLikelihood) xo.getChild(GMRFSkyrideLikelihood.class);
    return new GMRFIntervalHeightsStatistic(name, skyrideLikelihood);
}
Also used : GMRFSkyrideLikelihood(dr.evomodel.coalescent.GMRFSkyrideLikelihood) GMRFIntervalHeightsStatistic(dr.evomodel.coalescent.GMRFIntervalHeightsStatistic)

Example 2 with GMRFSkyrideLikelihood

use of dr.evomodel.coalescent.GMRFSkyrideLikelihood in project beast-mcmc by beast-dev.

the class GMRFPopSizeStatisticParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    double[] times;
    if (xo.hasAttribute(FROM)) {
        double from = xo.getDoubleAttribute(FROM);
        double to = xo.getDoubleAttribute(TO);
        int number = xo.getIntegerAttribute(NUMBER_OF_INTERVALS);
        double length = (to - from) / number;
        times = new double[number + 1];
        for (int i = 0; i < times.length; i++) {
            times[i] = from + i * length;
        }
    } else {
        times = xo.getDoubleArrayAttribute(TIMES);
    }
    GMRFSkyrideLikelihood gsl = (GMRFSkyrideLikelihood) xo.getChild(GMRFSkyrideLikelihood.class);
    return new GMRFPopSizeStatistic(times, gsl);
}
Also used : GMRFSkyrideLikelihood(dr.evomodel.coalescent.GMRFSkyrideLikelihood) GMRFPopSizeStatistic(dr.evomodel.coalescent.GMRFPopSizeStatistic)

Example 3 with GMRFSkyrideLikelihood

use of dr.evomodel.coalescent.GMRFSkyrideLikelihood in project beast-mcmc by beast-dev.

the class GMRFSkyrideFixedEffectsGibbsOperatorParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
    GMRFSkyrideLikelihood gmrfLikelihood = (GMRFSkyrideLikelihood) xo.getChild(GMRFSkyrideLikelihood.class);
    MultivariateDistributionLikelihood likelihood = (MultivariateDistributionLikelihood) xo.getChild(MultivariateDistributionLikelihood.class);
    MultivariateDistribution prior = likelihood.getDistribution();
    if (prior.getType().compareTo(MultivariateNormalDistribution.TYPE) != 0)
        throw new XMLParseException("Only a multivariate normal distribution is conjugate for the regression coefficients in a GMRF");
    Parameter param = (Parameter) xo.getChild(Parameter.class);
    return new GMRFSkyrideFixedEffectsGibbsOperator(param, gmrfLikelihood, prior, weight);
}
Also used : MultivariateDistributionLikelihood(dr.inference.distribution.MultivariateDistributionLikelihood) MultivariateDistribution(dr.math.distributions.MultivariateDistribution) GMRFSkyrideLikelihood(dr.evomodel.coalescent.GMRFSkyrideLikelihood) Parameter(dr.inference.model.Parameter) GMRFSkyrideFixedEffectsGibbsOperator(dr.evomodel.coalescent.operators.GMRFSkyrideFixedEffectsGibbsOperator)

Aggregations

GMRFSkyrideLikelihood (dr.evomodel.coalescent.GMRFSkyrideLikelihood)3 GMRFIntervalHeightsStatistic (dr.evomodel.coalescent.GMRFIntervalHeightsStatistic)1 GMRFPopSizeStatistic (dr.evomodel.coalescent.GMRFPopSizeStatistic)1 GMRFSkyrideFixedEffectsGibbsOperator (dr.evomodel.coalescent.operators.GMRFSkyrideFixedEffectsGibbsOperator)1 MultivariateDistributionLikelihood (dr.inference.distribution.MultivariateDistributionLikelihood)1 Parameter (dr.inference.model.Parameter)1 MultivariateDistribution (dr.math.distributions.MultivariateDistribution)1