Search in sources :

Example 6 with StateHistory

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);
    }
}
Also used : StateHistory(dr.inference.markovjumps.StateHistory)

Example 7 with StateHistory

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);
    }
}
Also used : StateHistory(dr.inference.markovjumps.StateHistory)

Aggregations

StateHistory (dr.inference.markovjumps.StateHistory)7 Vector (dr.math.matrixAlgebra.Vector)2 NodeRef (dr.evolution.tree.NodeRef)1 UniformizedSubstitutionModel (dr.evomodel.substmodel.UniformizedSubstitutionModel)1 SubordinatedProcess (dr.inference.markovjumps.SubordinatedProcess)1 UniformizedStateHistory (dr.inference.markovjumps.UniformizedStateHistory)1