Search in sources :

Example 91 with Parameter

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

the class MicrosatelliteFullAncestryImportanceSamplingOperatorParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    final double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
    final Parameter parameter = (Parameter) xo.getChild(Parameter.class);
    final MicrosatelliteSamplerTreeModel msatSamplerTreeModel = (MicrosatelliteSamplerTreeModel) xo.getChild(MicrosatelliteSamplerTreeModel.class);
    final MicrosatelliteModel msatModel = (MicrosatelliteModel) xo.getChild(MicrosatelliteModel.class);
    final BranchRateModel branchRateModel = (BranchRateModel) xo.getChild(BranchRateModel.class);
    return new MicrosatelliteFullAncestryImportanceSamplingOperator(parameter, msatSamplerTreeModel, msatModel, branchRateModel, weight);
}
Also used : MicrosatelliteModel(dr.oldevomodel.substmodel.MicrosatelliteModel) MicrosatelliteSamplerTreeModel(dr.evomodel.tree.MicrosatelliteSamplerTreeModel) BranchRateModel(dr.evomodel.branchratemodel.BranchRateModel) MicrosatelliteFullAncestryImportanceSamplingOperator(dr.evomodel.operators.MicrosatelliteFullAncestryImportanceSamplingOperator) Parameter(dr.inference.model.Parameter)

Example 92 with Parameter

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

the class MomentDistributionModelParser method parseXMLObject.

@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    Parameter mean = (Parameter) xo.getChild(MEAN).getChild(0);
    Parameter prec = (Parameter) xo.getChild(PREC).getChild(0);
    Parameter cutoff = null;
    if (xo.getChild(CUTOFF) != null) {
        cutoff = (Parameter) xo.getChild(CUTOFF).getChild(0);
    }
    Parameter data = (Parameter) xo.getChild(DATA).getChild(0);
    return new MomentDistributionModel(mean, prec, cutoff, data);
}
Also used : Parameter(dr.inference.model.Parameter) MomentDistributionModel(dr.inference.distribution.MomentDistributionModel)

Example 93 with Parameter

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

the class MultivariateNormalDistributionModelParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    XMLObject cxo = xo.getChild(MultivariateDistributionLikelihood.MVN_MEAN);
    Parameter mean = (Parameter) cxo.getChild(Parameter.class);
    cxo = xo.getChild(MultivariateDistributionLikelihood.MVN_PRECISION);
    MatrixParameter precision = (MatrixParameter) cxo.getChild(MatrixParameter.class);
    if (mean.getDimension() != precision.getRowDimension() || mean.getDimension() != precision.getColumnDimension())
        throw new XMLParseException("Mean and precision have wrong dimensions in " + xo.getName() + " element");
    return new MultivariateNormalDistributionModel(mean, precision);
}
Also used : MatrixParameter(dr.inference.model.MatrixParameter) MultivariateNormalDistributionModel(dr.inference.distribution.MultivariateNormalDistributionModel) Parameter(dr.inference.model.Parameter) MatrixParameter(dr.inference.model.MatrixParameter)

Example 94 with Parameter

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

the class MultivariateOUModelParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    SubstitutionModel substitutionModel = (SubstitutionModel) xo.getChild(SubstitutionModel.class);
    Parameter effectParameter = (Parameter) ((XMLObject) xo.getChild(DATA)).getChild(Parameter.class);
    Parameter timesParameter = (Parameter) ((XMLObject) xo.getChild(TIME)).getChild(Parameter.class);
    Parameter designParameter = (Parameter) ((XMLObject) xo.getChild(DESIGN)).getChild(Parameter.class);
    MatrixParameter gammaParameter = (MatrixParameter) xo.getChild(MatrixParameter.class);
    if (effectParameter.getDimension() != timesParameter.getDimension() || effectParameter.getDimension() != designParameter.getDimension()) {
        //				System.err.println("dim(design) "+designParameter.getDimension());
        throw new XMLParseException("dim(" + effectParameter.getStatisticName() + ") != dim(" + timesParameter.getStatisticName() + ") != dim(" + designParameter.getStatisticName() + ") in " + xo.getName() + " element");
    }
    MultivariateOUModel glm = new MultivariateOUModel(substitutionModel, effectParameter, gammaParameter, timesParameter.getParameterValues(), designParameter.getParameterValues());
    addIndependentParameters(xo, glm, effectParameter);
    return glm;
}
Also used : MatrixParameter(dr.inference.model.MatrixParameter) MultivariateOUModel(dr.inferencexml.distribution.MultivariateOUModel) Parameter(dr.inference.model.Parameter) MatrixParameter(dr.inference.model.MatrixParameter) SubstitutionModel(dr.oldevomodel.substmodel.SubstitutionModel)

Example 95 with Parameter

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

the class MultivariateOUModelParser method addIndependentParameters.

public void addIndependentParameters(XMLObject xo, GeneralizedLinearModel glm, Parameter dependentParam) throws XMLParseException {
    int totalCount = xo.getChildCount();
    for (int i = 0; i < totalCount; i++) {
        if (xo.getChildName(i).compareTo(GeneralizedLinearModelParser.INDEPENDENT_VARIABLES) == 0) {
            XMLObject cxo = (XMLObject) xo.getChild(i);
            Parameter independentParam = (Parameter) cxo.getChild(Parameter.class);
            DesignMatrix designMatrix = (DesignMatrix) cxo.getChild(DesignMatrix.class);
            checkDimensions(independentParam, dependentParam, designMatrix);
            glm.addIndependentParameter(independentParam, designMatrix, null);
        }
    }
}
Also used : Parameter(dr.inference.model.Parameter) MatrixParameter(dr.inference.model.MatrixParameter) DesignMatrix(dr.inference.model.DesignMatrix)

Aggregations

Parameter (dr.inference.model.Parameter)397 TreeModel (dr.evomodel.tree.TreeModel)62 MatrixParameter (dr.inference.model.MatrixParameter)46 ArrayList (java.util.ArrayList)44 FrequencyModel (dr.oldevomodel.substmodel.FrequencyModel)43 FrequencyModel (dr.evomodel.substmodel.FrequencyModel)41 Units (dr.evolution.util.Units)36 XMLUnits (dr.evoxml.util.XMLUnits)36 BranchRateModel (dr.evomodel.branchratemodel.BranchRateModel)30 Tree (dr.evolution.tree.Tree)25 DataType (dr.evolution.datatype.DataType)24 GammaSiteRateModel (dr.evomodel.siteratemodel.GammaSiteRateModel)23 CompoundParameter (dr.inference.model.CompoundParameter)23 GammaSiteModel (dr.oldevomodel.sitemodel.GammaSiteModel)21 SitePatterns (dr.evolution.alignment.SitePatterns)20 HKY (dr.evomodel.substmodel.nucleotide.HKY)17 Likelihood (dr.inference.model.Likelihood)17 HomogeneousBranchModel (dr.evomodel.branchmodel.HomogeneousBranchModel)16 DefaultBranchRateModel (dr.evomodel.branchratemodel.DefaultBranchRateModel)16 ParametricDistributionModel (dr.inference.distribution.ParametricDistributionModel)16