use of dr.oldevomodel.substmodel.TwoStateCovarionModel in project beast-mcmc by beast-dev.
the class TwoStateCovarionModelParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
Parameter alphaParameter;
Parameter switchingRateParameter;
XMLObject cxo = xo.getChild(AbstractCovarionDNAModel.FREQUENCIES);
FrequencyModel freqModel = (FrequencyModel) cxo.getChild(FrequencyModel.class);
// fancy new datatype courtesy of Helen
TwoStateCovarion dataType = TwoStateCovarion.INSTANCE;
cxo = xo.getChild(ALPHA);
alphaParameter = (Parameter) cxo.getChild(Parameter.class);
// alpha must be positive and less than 1.0 because the fast rate is normalized to 1.0
alphaParameter.addBounds(new Parameter.DefaultBounds(1.0, 0.0, 1));
cxo = xo.getChild(SWITCHING_RATE);
switchingRateParameter = (Parameter) cxo.getChild(Parameter.class);
if (dataType != freqModel.getDataType()) {
throw new XMLParseException("Data type of " + getParserName() + " element does not match that of its frequencyModel.");
}
TwoStateCovarionModel model = new TwoStateCovarionModel(dataType, freqModel, alphaParameter, switchingRateParameter);
System.out.println(model);
return model;
}
use of dr.oldevomodel.substmodel.TwoStateCovarionModel in project beast-mcmc by beast-dev.
the class TwoStateCovarionModelTest method setUp.
public void setUp() throws Exception {
super.setUp();
frequencies = new Parameter.Default(new double[] { 0.25, 0.25, 0.25, 0.25 });
alpha = new Parameter.Default(0.0);
switchingRate = new Parameter.Default(1.0);
FrequencyModel freqModel = new FrequencyModel(TwoStateCovarion.INSTANCE, frequencies);
model = new TwoStateCovarionModel(TwoStateCovarion.INSTANCE, freqModel, alpha, switchingRate);
dataType = model.getDataType();
}
Aggregations