use of dr.inference.markovjumps.StateHistory in project beast-mcmc by beast-dev.
the class CodonPartitionedRobustCounting method fillInUnconditionalTraitValues.
private void fillInUnconditionalTraitValues(double expectedLength, double[] freq, double[] out) {
final int stateCount = 64;
double[] lambda = new double[stateCount * stateCount];
fillInUnconditionalQMatrix(lambda);
for (int i = 0; i < numCodons; i++) {
final int startingState = MathUtils.randomChoicePDF(freq);
StateHistory history = StateHistory.simulateUnconditionalOnEndingState(0.0, startingState, expectedLength, lambda, stateCount);
out[i] = markovJumps.getProcessForSimulant(history);
}
}
use of dr.inference.markovjumps.StateHistory in project beast-mcmc by beast-dev.
the class CodonPartitionedRobustCounting method getUnconditionedTraitValue.
public Double getUnconditionedTraitValue() {
if (!TRIAL) {
throw new RuntimeException("Believed broken for neutral models");
// return markovJumps.getMarginalRate() * getExpectedTreeLength();
} else {
final double treeLength = getExpectedTreeLength();
double[] rootDistribution = getUnconditionalRootDistribution();
final int startingState = MathUtils.randomChoicePDF(rootDistribution);
final int stateCount = 64;
double[] lambda = new double[stateCount * stateCount];
fillInUnconditionalQMatrix(lambda);
StateHistory history = StateHistory.simulateUnconditionalOnEndingState(0.0, startingState, treeLength, lambda, stateCount);
return markovJumps.getProcessForSimulant(history);
}
}
Aggregations