r_ou {goffda} | R Documentation |
Simulation of an Ornstein–Uhlenbeck process
Description
Simulation of trajectories of the Ornstein–Uhlenbeck process
. The process is the solution to the stochastic
differential equation
whose stationary distribution is , for
and
.
Given an initial point and the evaluation times
, a sample trajectory
can be obtained by sampling the joint Gaussian distribution of
.
Usage
r_ou(n, t = seq(0, 1, len = 201), mu = 0, alpha = 1, sigma = 1,
x0 = rnorm(n, mean = mu, sd = sigma/sqrt(2 * alpha)))
Arguments
n |
number of trajectories to sample. |
t |
evaluation times for the trajectories, a vector. |
mu |
mean of the process, a scalar. |
alpha |
strength of the drift, a positive scalar. |
sigma |
diffusion coefficient, a positive scalar. |
x0 |
a vector of length |
Value
Random trajectories, an fdata
object of
length n
and t
as argvals
.
Author(s)
Eduardo García-Portugués.
Examples
# Same initial point
plot(r_ou(n = 20, x0 = 5), col = viridisLite::viridis(20))
# Different initial points
plot(r_ou(n = 100, alpha = 2, sigma = 4, x0 = 1:100),
col = viridisLite::viridis(100))