Learn R Programming

Sim.DiffProc (version 2.5)

OU: Creating Ornstein-Uhlenbeck Process

Description

Simulation the ornstein-uhlenbeck or Hull-White/Vasicek model.

Usage

OU(N, t0, T, x0, r, sigma, output = FALSE)

Arguments

N
size of process.
t0
initial time.
T
final time.
x0
initial value of the process at time t0.
r
constant positive (r is speed of reversion and -r * X(t) :drift coefficient).
sigma
constant positive (sigma (volatility) :diffusion coefficient).
output
if output = TRUE write a output to an Excel (.csv).

Value

  • data.frame(time,x) and plot of process.

Details

The Ornstein-Uhlenbeck or Vasicek process is the unique solution to the following stochastic differential equation : $$dX(t) = - r * X(t) * dt + sigma * dW(t)$$ With -r * X(t) :drift coefficient and sigma : diffusion coefficient, W(t) is Wiener process, the discretization dt = (T-t0)/N. Please note that the process is stationary only if r > 0.

See Also

OUF Flow of Ornstein-Uhlenbeck Process, PEOU Parametric Estimation of Ornstein-Uhlenbeck Model, PEOUexp Explicit Estimators of Ornstein-Uhlenbeck Model, snssde Simulation Numerical Solution of SDE.

Examples

Run this code
## Ornstein-Uhlenbeck Process
## dX(t) = -2 * X(t) * dt + 1 *dW(t)
 OU(N=1000,t0=0,T=10,x0=10,r=2,sigma=1)

Run the code above in your browser using DataLab