sim.Stasis.RW: Simulate trait evolution with a mode shift

View source: R/complexModels.R

sim.Stasis.RWR Documentation

Simulate trait evolution with a mode shift

Description

Trait evolution is modeled as a shift from a random walk (general or unbiased) to stasis, or vice versa.

Usage

sim.Stasis.RW(
  ns = c(20, 20),
  order = c("Stasis-RW", "RW-Stasis"),
  anc = 0,
  omega = 1,
  ms = 0,
  vs = 1,
  vp = 1,
  nn = 30,
  tt = NULL
)

Arguments

ns

vector of the number of samples in each segment

order

whether stasis or random walk come first, one of "Stasis-RW" or "RW-Stasis"

anc

starting trait value

omega

variance of stasis segment

ms

step mean during random walk segment

vs

step variance during random walk segment

vp

phenotypic trait variance for each population

nn

vector of sample sizes for each population

tt

vector of times (ages) for each population

Details

The anc argument is the starting trait value, and if the first segment is stasis, this is also the value of the stasis mean. When the first segment is a random walk, the stasis mean in the second segment is equal to the true trait mean at the end of the initial random walk.

Value

a paleoTSfit object

See Also

fitModeShift

Examples

x1 <- sim.Stasis.RW(omega = 0.1, ms = 5, order = "Stasis-RW")
x2 <- sim.Stasis.RW(omega = 0.1, ms = 5, order = "RW-Stasis")
plot(x1)
plot(x2, add = TRUE, col = "blue")
abline(v = 19, lty=3)


paleoTS documentation built on Aug. 9, 2022, 1:06 a.m.