R: Simulate a Stochastic Process on a tree

simulate_internal {PhylogeneticEM} | R Documentation

## 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` | Dimension of the simulated trait
`root.state` | List describing the state of the root, with: random random state (TRUE) or deterministic state (FALSE) value.root if deterministic, value of the character at the root exp.root if random, expectation of the character at the root var.root if random, variance of the character at the root (pxp matrix)
`shifts` | List with position and values of the shifts : edges vector of the K id of edges where the shifts are values matrix p x K of values of the shifts on the edges (one column = one shift) relativeTimes vector of dimension K of relative time of the shift from the parent node of edges
`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 specified to avoid extra computations.
`df` | if the process is "StudentOU", the number of degree of freedom of the chosen student law. default to 1.

### Value

paramSimu An array with dimensions 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 value for all the nodes.

[Package PhylogeneticEM version 1.1.0 Index]