ornstein_uhlenbeck {StratPal} | R Documentation |
Simulates an Ornstein-Uhlenbeck process using the Euler-Maruyama method. The process is simulated on a scale of 0.25 * min(diff(t))
and then interpolated to the values of t
.
ornstein_uhlenbeck(t, mu = 0, theta = 1, sigma = 1, y0 = 0)
t |
times at which the process is simulated. Can be heterodistant |
mu |
number, long term mean |
theta |
number, mean reversion speed |
sigma |
positive number, strength of randomness |
y0 |
number, initial value (value of process at the first entry of t) |
A list with two elements: t
and y
. t
is a duplicate of the input t
, y
are the values of the OU process at these times. Output list is of S3 class timelist
(inherits from list
) and can thus be plotted directly using plot
, see ?admtools::plot.timelist
ornstein_uhlenbeck_sl()
for simulation on specimen level - for use in conjunction with paleoTS
package
random_walk()
and stasis()
to simulate other modes of evolution
library("admtools") # required for plotting of results
t = seq(0, 3, by = 0.01)
l = ornstein_uhlenbeck(t, y0 = 3) # start away from optimum (mu)
plot(l, type = "l")
l2 = ornstein_uhlenbeck(t, y0 = 0) # start in optimum
lines(l2$t, l2$y, col = "red")