Function to simulate continuous trait value histories on a phylogeny.
simulate_traits.Rd
Function to simulate continuous trait value histories on a phylogeny.
Arguments
- phy
A phylogenetic tree (phylo object) on which to simulate traits
- rate_model
The type of rate model for how rates of evolution evolve on the phylogeny: "continuous" for continuous Brownian motion evolution of rates, or "discrete" for evolution of rate "classes" across the phylogeny, using an mk model.
- temp_trend_rates
What temporal trend in rates should there be? A positive number for an increase, and negative number for a decrease with the magnitude controlling the strength of linear change. This trend is added to rates simulated under the rate_model.
- rate_change
If
rate_model
is "continuous", this should be a single positive number controlling how fast rates change continuously along the tree. Ifrate_model
is "discrete", this should be a transition matrix for the rate classes. Or, ifrate_model
is "discrete", and this can be a length 2 numeric vector specifying- rates
Only used if
rate_model
is "discrete", in which case this should be a named vector whose values are the rates in each rate class, and whose names are the rate class states (e.g.c("1" = 3, "2" = 10)
). Seesim.history
, for more detail on how the discrete model works. Or, if an unnamed numeric vector of length two, a mean and standard deviation parameterizing a normal distribution from which to draw rates for each rate class. IfNULL
, rates will be drawn from a normals distribution with mean = 0 and sd = 1.- anc
Value of the trait at the root ancestor. For
rate_model = "discrete"
, can be a length 1 named vector where the name is the ancestral state, and the value is the trait starting value. Forrate_model = "continuous"
, any names are ignored, but should be length 2, where the first element is the ancestral trait value and the second element is the ancestral rate of evolution.- internal
Logical value. If
TRUE
return trait states at internal nodes.- nsim
Number of simulation to run.
- pos_strat
?
- temp_trend_mean
A temporal trend in rates.