Search in sources :

Example 1 with AutoCorrelatedRatesWithBayesianBridge

use of dr.evomodel.branchratemodel.shrinkage.AutoCorrelatedRatesWithBayesianBridge in project beast-mcmc by beast-dev.

the class AutoCorrelatedRatesBayesianBridgeParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    AutoCorrelatedBranchRatesDistribution ratesDistribution = (AutoCorrelatedBranchRatesDistribution) xo.getChild(AutoCorrelatedBranchRatesDistribution.class);
    XMLObject globalXo = xo.getChild(GLOBAL_SCALE);
    Parameter globalScale = (Parameter) globalXo.getChild(Parameter.class);
    Parameter localScale = null;
    if (xo.hasChildNamed(LOCAL_SCALE)) {
        XMLObject localXo = xo.getChild(LOCAL_SCALE);
        localScale = (Parameter) localXo.getChild(Parameter.class);
        if (localScale.getDimension() != ratesDistribution.getDimension()) {
            throw new XMLParseException("Local scale dimension (" + localScale.getDimension() + ") != rates dimension (" + ratesDistribution.getDimension() + ")");
        }
    }
    XMLObject exponentXo = xo.getChild(EXPONENT);
    Parameter exponent = (Parameter) exponentXo.getChild(Parameter.class);
    Parameter slabWidth = ParameterParser.getOptionalParameter(xo, SLAB_WIDTH);
    BayesianBridgeDistributionModel distributionModel = (localScale != null) ? new JointBayesianBridgeDistributionModel(globalScale, localScale, exponent, slabWidth, 1) : new MarginalBayesianBridgeDistributionModel(globalScale, exponent, 1);
    return new AutoCorrelatedRatesWithBayesianBridge(ratesDistribution, distributionModel);
}
Also used : AutoCorrelatedBranchRatesDistribution(dr.evomodel.branchratemodel.AutoCorrelatedBranchRatesDistribution) Parameter(dr.inference.model.Parameter) MatrixParameter(dr.inference.model.MatrixParameter) AutoCorrelatedRatesWithBayesianBridge(dr.evomodel.branchratemodel.shrinkage.AutoCorrelatedRatesWithBayesianBridge)

Aggregations

AutoCorrelatedBranchRatesDistribution (dr.evomodel.branchratemodel.AutoCorrelatedBranchRatesDistribution)1 AutoCorrelatedRatesWithBayesianBridge (dr.evomodel.branchratemodel.shrinkage.AutoCorrelatedRatesWithBayesianBridge)1 MatrixParameter (dr.inference.model.MatrixParameter)1 Parameter (dr.inference.model.Parameter)1