AncestralTypeLikelihood
- public class tyche.evolution.likelihood.AncestralTypeLikelihood extends beast.base.evolution.likelihood.TreeLikelihood
AncestralTypeLikelihood to assess likelihood of internal and ambiguous node types.
- String STATES_KEY
- Input tagInput
input object, a string label for reconstruction characters in tree log
- Input useJava
input object, prefer java, even if beagle is available, default: true
- Input nodeTypesInput
input object, the type associated with each node
- IntegerParameter nodeTypes
- double qMatrix
- int patternCount
- int stateCount
- int tipStates
- Helper treeTraits
Method required for implementing TreeTraitProvider
for logging with beastclassic.evolution.tree.TreeWithTraitLogger
- DataType dataType
- String tag
- double jointLogLikelihood
- double storedJointLogLikelihood
- public void initAndValidate()
Initialize the model and validate inputs
- protected boolean requiresRecalculation()
Whether the likelihood needs to be recalculated.
true if any node types have been operated on or if anything has been operated on that would make any normal treelikelihood
model need to be recalculated
- Returns:
true if anything this model depends on has changed since the last time it was calculated
- public double calculateLogP()
Calculate the likelihood of the ancestral type reconstruction.
- Returns:
the likelihood in log space
- public void traverseTypeTree(Node node, int parentState)
Helper to calculate the likelihood of the ancestral type reconstruction by recursively traversing the tree.
Updates this.jointLogLikelihood
- Parameters:
node – the current node
parentState – the state (type) of the parent of the current node
- public void store()
Store the current values of fields that should be restored after a rejected proposal.
- public void restore()
Restore the stored values of fields that were saved before a proposal.
- public void getTransitionMatrix(int nodeNum, double probabilities)
Helper method to get the transition matrix, wrapper for beagle/likelihoodCore calls
- Parameters:
nodeNum – the number of the current node
probabilities – the array to write transition matrix probabilities to
- public DataType getDataType()
Method required for implementing TreeTraitProvider
for logging with beastclassic.evolution.tree.TreeWithTraitLogger
- public int getStatesForNode(TreeInterface tree, Node node)
Method required for implementing TreeTraitProvider
for logging with beastclassic.evolution.tree.TreeWithTraitLogger
- public TreeTrait getTreeTraits()
Method required for implementing TreeTraitProvider
for logging with beastclassic.evolution.tree.TreeWithTraitLogger
- public TreeTrait getTreeTrait(String key)
Method required for implementing TreeTraitProvider
for logging with beastclassic.evolution.tree.TreeWithTraitLogger
- private static String getFormattedState(int state, DataType dataType)
Method required for implementing TreeTraitProvider
for logging with beastclassic.evolution.tree.TreeWithTraitLogger