View source: R/posteriorpredictive_functions.R
sim_history_unconditional | R Documentation |
Simulate history of discrete-character changes over a bifurcation tree without conditioning on the tip states
sim_history_unconditional( tree, Q, Q_ages = NULL, states, root_freq = NULL, nsim = 1L )
tree |
A bifurcation tree of class "phylo" |
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 |
root_freq |
A vector of frequencies at the root of the tree (that we will draw the root state from); if NULL then it's uniform |
nsim |
Number of simulations to perform |
A phylo and simmap object (or a multiPhylo and multiSimmap object when nsim > 1) that contains the simulated full history
tree <- ape::rtree(7) Q <- list(matrix(c(-1, 1, 1, -1), ncol = 2, byrow = TRUE)) states <- c("A", "B") root_freq <- setNames(rep(0.5, 2), c("A", "B")) one_history <- sim_history_unconditional(tree, Q, states = states, root_freq = root_freq)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.