View source: R/simulate_phylogenetic_gaussian_process.R
simulate_phylogenetic_ou | R Documentation |
A wrapper for ape::rTraitCont which simulates an Ornstein-Uhlenbeck process over the phylogeny phy such that the phylogenetic Gaussian process
f ( \boldsymbol t )) \sim \mathcal{GP} ( 0, k (t, t' ))))
for
k (t, t' )) = heritable_amplitude^2 \exp ( - \frac{d (t, t' ))}{length_scale})) + environmental_amplitude^2 δ ( t_1, …, t_S ))
parameterised by heritable_amplitude > 0, length_scale > 0, and environmental_amplitude > 0, where t is a position on the phylogeny, d (t, t') is the length of the shortest path from t to t', t_1, …, t_S are positions corresponding to the S extant taxa, and δ ( \cdot )) is the indicator function.
simulate_phylogenetic_ou( phy, heritable_amplitude = 1, length_scale = 2, environmental_amplitude = 0, internal = FALSE, perform_checks = TRUE )
phy |
An object of class "phylo". |
heritable_amplitude |
A positive real-valued scalar. The amplitude of the phylogenetic OU process. Note that this is the square root of the variance and so should be thought of as a standard deviation parameter. |
length_scale |
A positive real number. The length-scale of the Ornstein-Uhlenbeck process. |
environmental_amplitude |
A positive real-valued scalar. The amplitude of non-phylogenetic variation in the traits of extant taxa. N Note that this is the square root of the variance and so should be thought of as a standard deviation parameter. |
internal |
A logical value. Specifies whether to return the values at internal nodes |
perform_checks |
Logical. Check if function inputs are specified correctly. |
A numeric vector with names taken from the tip labels of phy. If ancestor = TRUE, the node labels are used if present, otherwise, “Node1”, “Node2”, etc.
S <- 100 tr <- ape::rtree(S) z <- simulate_phylogenetic_ou(tr)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.