Library: | times |
See also: | simGBM simHeston |
Quantlet: | simgOU | |
Description: | Simulation of discrete observations of a generalized Ornstein-Uhlenbeck process via Euler scheme. The process follows the stochastic differential equation: dX(t) = beta (L - X(t)) dt + sigma (X(t)^gamma) dW(t). |
Usage: | x = simgOU(n,x0,beta,L,rho,gamma,delta) | |
Input: | ||
n | scalar, time. The number of observations is represented by (ceil(n/delta)+1) | |
x0 | scalar, starting value of the process | |
beta | scalar, speed of mean reversion | |
L | scalar, long-term mean | |
rho | scalar, volatility | |
gamma | scalar, scaling factor | |
delta | scalar, time step size. The process is simulated at time points 0, delta, 2*delta, ..., n*delta | |
Output: | ||
x | (n+1) x 1 vector, simulated trajectory |
randomize(123) library("times") library("plot") days = 250 time =(0:days)/days L = .1 x = 100*simgOU(1,.1,3,L,.29,.5,1/days) s1 = setmask(time~x,"line","black","thin","solid") d1 = createdisplay(1,1) show(d1,1,1,s1)
A display containing a typical trajectory of a gOU process is shown.