simulate_phylogenetic_ou: Simulate a Phylogenetic Ornstein-Uhlenbeck process

View source: R/simulate_phylogenetic_gaussian_process.R

simulate_phylogenetic_ouR Documentation

Simulate a Phylogenetic Ornstein-Uhlenbeck process

Description

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.

Usage

simulate_phylogenetic_ou(
  phy,
  heritable_amplitude = 1,
  length_scale = 2,
  environmental_amplitude = 0,
  internal = FALSE,
  perform_checks = TRUE
)

Arguments

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.

Value

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.

Examples

S <- 100
tr <- ape::rtree(S)
z <- simulate_phylogenetic_ou(tr)

jpmeagher/vbar documentation built on Nov. 22, 2022, 5:48 a.m.