View source: R/posteriorpredictive_functions.R
sim_history_conditional | R Documentation |
Simulate history of discrete-character changes over a bifurcation tree conditioning on the tip states (currently on all node states) we can relax this to allow only conditioning on the tip states, which would require an implementation of pruning algorithm (including transition-probablity matrix computation)
sim_history_conditional( tree, Q, Q_ages = NULL, states, nsim = 1L, trait = NULL )
tree |
A bifurcation tree of class "phylo" (here we assume it either has a node.states, node.data, or maps component so that we can fetch the state of each node, both internal and tip, in the tree to condition on) |
Q |
An instantaneous-rate matrix (or a list of matrices for a piecewise constant geographic model) characterizes the CTMC |
Q_ages |
A vector containing boundaries of time intervals for a piecewise constant geographic model (NULL means a constant model); the length of this vector should be one shorter than the Q-matrix list, sorted from oldest to youngest. |
states |
States of the discrete character |
nsim |
Number of simulations to perform |
trait |
Name of the discrete trait used in the tree file (e.g., "states") |
A phylo and simmap object (or a multiPhylo and multiSimmap object when nsim > 1) that contains the simulated full history
## Not run: tree <- ape::rtree(7) Q <- list(matrix(c(-1, 1, 1, -1), ncol = 2, byrow = TRUE)) states <- c("A", "B") one_history <- sim_history_conditional(tree, Q, states = states) # todo: add a tree to data file ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.