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);
}
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);
}
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);
}
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;
}
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);
}
}
}
Aggregations