powered by
Simulate sample paths from an Ornstein-Uhlenbeck process using the Euler-Maruyama discretization scheme.
r.ou(n, t, mu = 0, theta = 1, sigma = 1, x0 = 0, seed = NULL)
An fdata object containing the simulated paths.
Number of sample paths to generate.
Evaluation points (numeric vector).
Long-term mean (default 0).
Mean reversion rate (default 1).
Volatility (default 1).
Initial value (default 0).
Optional random seed.
The OU process satisfies the SDE: dX(t) = -theta * X(t) dt + sigma * dW(t)
t <- seq(0, 1, length.out = 100) ou_data <- r.ou(n = 20, t = t, theta = 2, sigma = 1) plot(ou_data)
Run the code above in your browser using DataLab