simulate_rou_model {castor} | R Documentation |

Given a rooted phylogenetic tree and a reflected Ornstein-Uhlenbeck (ROU) model for the evolution of a continuous (numeric) trait, simulate random outcomes of the model on all nodes and/or tips of the tree. The ROU process is similar to the Ornstein-Uhlenbeck process (see `simulate_ou_model`

), with the difference that the ROU process cannot fall below a certain value (its "reflection point"), which (in this implementation) is also its deterministic equilibrium point (Hu et al. 2015). The function traverses nodes from root to tips and randomly assigns a state to each node or tip based on its parent's previously assigned state and the specified model parameters. The generated states have joint distributions consistent with the ROU model. Optionally, multiple independent simulations can be performed using the same model.

simulate_rou_model(tree, reflection_point, spread, decay_rate, include_tips=TRUE, include_nodes=TRUE, Nsimulations=1, drop_dims=TRUE)

`tree` |
A rooted tree of class "phylo". The root is assumed to be the unique node with no incoming edge. |

`reflection_point` |
Numeric. The reflection point of the ROU model. In castor, this also happens to be the deterministic equilibrium of the ROU process (i.e. if the decay rate were infinite). For example, if a trait can only be positive (but arbitrarily small), then |

`spread` |
Numeric. The stationary standard deviation of the corresponding unreflected OU process. |

`decay_rate` |
Numeric. Exponential decay rate (stabilization rate) of the ROU process (in units 1/edge_length_units). |

`include_tips` |
Include random states for the tips. If |

`include_nodes` |
Include random states for the nodes. If |

`Nsimulations` |
Number of random independent simulations to perform. For each node and/or tip, there will be |

`drop_dims` |
Logical, specifying whether the returned |

For each simulation, the state of the root is picked randomly from the stationary distribution of the ROU model, i.e. from a one-sided normal distribution with mode = `reflection_point`

and standard deviation = `stationary_std`

.

If `tree$edge.length`

is missing, each edge in the tree is assumed to have length 1. The tree may include multi-furcations (i.e. nodes with more than 2 children) as well as mono-furcations (i.e. nodes with only one child). The asymptotic time complexity of this function is O(Nedges*Nsimulations), where Nedges is the number of edges in the tree.

A list with the following elements:

`tip_states` |
Either |

`node_states` |
Either |

Stilianos Louca

Y. Hu, C. Lee, M. H. Lee, J. Song (2015). Parameter estimation for reflected Ornstein-Uhlenbeck processes with discrete observations. Statistical Inference for Stochastic Processes. 18:279-291.

`simulate_ou_model`

, `simulate_bm_model`

, `simulate_mk_model`

# generate a random tree tree = generate_random_tree(list(birth_rate_intercept=1),max_tips=10000)$tree # simulate evolution of a continuous trait whose value is always >=1 tip_states = simulate_rou_model(tree, reflection_point=1, spread=2, decay_rate=0.1)$tip_states # plot histogram of simulated tip states hist(tip_states, breaks=20, xlab="state", main="Trait probability distribution", prob=TRUE)

[Package *castor* version 1.7.0 Index]