Learn R Programming

PhylogeneticEM (version 1.0.0)

simulate_internal: Simulate a Stochastic Process on a tree

Description

simulate_internal simulate a stochastic process on a tree.

Usage

simulate_internal(phylo, process = c("BM", "OU", "scOU", "StudentOU"), p = 1, root.state = list(random = FALSE, stationary.root = FALSE, value.root = NA, exp.root = NA, var.root = NA), shifts = list(edges = NULL, values = NULL, relativeTimes = NULL), eps = 10^(-6), selection.strength = NULL, variance = NULL, optimal.value = NULL, checks = TRUE, simulate_random = TRUE, U_tree = NULL, times_shared = NULL, df = 1)

Arguments

phylo
a phylogenetic tree, class phylo.
process
The model used for the simulation. One of "BM" (for a full BM model, univariate or multivariate); "OU" (for a full OU model, univariate or multivariate); or "scOU" (for a "scalar OU" model).
p
Dimention of the simulated trait
root.state
List describing the state of the root, with:
shifts
List with position and values of the shifts :
eps
Tolerance for the value of the norm 1 of the selection strength matrix for OU
selection.strength
Matrix of selection strength size p x p (OU)
variance
Variance-covariance matrix size p x p
optimal.value
Vector of p optimal values at the root (OU)
checks
whether to check the entry parameters for consistency. Default to TRUE.
simulate_random
set to FALSE if only the expected values are needed (and not the random sample). Default to TRUE.
U_tree
optional, full incidence matrix of the tree, result of function incidence.matrix.full.
times_shared
optional, times of shared ancestry of all nodes and tips, result of function compute_times_ca. Can be precised to avoid extra computations.
df
if the process is "StudentOU", the number of degree of freedom of the choosen student law. default to 1.

Value

paramSimu An array with dimentions p x nNodes x 2 (BM) or p x nNodes x 3 (OU). For each trait t, 1 <= t="" <="p," paramsimu[t,="" ,="" ]="" has="" tree="" columns,="" containing="" respectively="" the="" simulated="" state,="" expected="" value="" and="" optimal="" for="" all="" nodes.="" dl="">