hOUwie.sim | R Documentation |
Simulates a discrete and continuous character following the hOUwie model. The function first evolves a discrete character based on the Q matrix provided. Next, it will evolve a continuous character following the given OU parameters and simulated discrete character. Like the hOUwie model, transitions between discrete states are assumed to take place half-way between nodes.
hOUwie.sim(phy,
Q,
root.freqs,
alpha,
sigma.sq,
theta0,
theta)
phy |
A phylogenetic tree, in |
Q |
A transition rate matrix with dimensions |
root.freqs |
A vector |
alpha |
A vector |
sigma.sq |
A vector |
theta0 |
A numeric value giving the starting value of the continuous character at the root. |
theta |
A vector |
The simulation protocol follows the hOUwie model where stochastic maps being produced are based on a node-by-node simulation. I.e., we first simulate the node states given the parameters and then branches are paintined based on transitions occuring half-way between the nodes.
data |
a dataframe of sp (species), reg (discrete character states), and x (continuous character values). |
simmap |
the history of the discrete character presented as a stochastic map. |
James D. Boyko
data(tworegime)
# simulate an OUM model
Q <- matrix(c(-1,1,1,-1), 2, 2)
root.freqs <- c(1, 0)
alpha <- c(2, 2)
sigma.sq <- c(1,1)
theta0 <- 5
theta <- c(5, 10)
simulated_data <- hOUwie.sim(tree, Q, root.freqs, alpha, sigma.sq, theta0, theta)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.