HWV | R Documentation |
The (S3) generic function for simulation of Hull-White/Vasicek or gaussian diffusion models, and Ornstein-Uhlenbeck process.
HWV(N, ...)
OU(N, ...)
## Default S3 method:
HWV(N = 100, M = 1, x0 = 2, t0 = 0, T = 1, Dt = NULL, mu = 4, theta = 1,
sigma = 0.1, ...)
## Default S3 method:
OU(N =100,M=1,x0=2,t0=0,T=1,Dt = NULL,mu=4,sigma=0.2, ...)
N |
number of simulation steps. |
M |
number of trajectories. |
x0 |
initial value of the process at time |
t0 |
initial time. |
T |
final time. |
Dt |
time step of the simulation (discretization). If it is |
mu |
parameter of the |
theta |
parameter of the |
sigma |
the volatility of the |
... |
potentially further arguments for (non-default) methods. |
The function HWV
returns a trajectory of the Hull-White/Vasicek process starting at x_{0}
at time t_{0}
;
i.e., the diffusion process solution of stochastic differential equation:
dX_{t}= \mu ( \theta -X_{t}) dt + \sigma dW_{t}
The function OU
returns a trajectory of the Ornstein-Uhlenbeck starting at x_{0}
at time t_{0}
;
i.e., the diffusion process solution of stochastic differential equation:
dX_{t}= -\mu X_{t} dt + \sigma dW_{t}
Constraints: \mu , \sigma >0
.
Please note that the process is stationary only if \mu >0
.
X |
an visible |
A.C. Guidoum, K. Boukhetala.
Vasicek, O. (1977). An Equilibrium Characterization of the Term Structure. Journal of Financial Economics, 5, 177–188.
rcOU
and rsOU
for conditional and stationary law of Vasicek process are available in "sde".
## Hull-White/Vasicek Models
## dX(t) = 4 * (2.5 - X(t)) * dt + 1 *dW(t), X0=10
set.seed(1234)
X <- HWV(N=1000,M=10,mu = 4, theta = 2.5,sigma = 1,x0=10)
plot(X,plot.type="single")
lines(as.vector(time(X)),rowMeans(X),col="red")
## Ornstein-Uhlenbeck Process
## dX(t) = -4 * X(t) * dt + 1 *dW(t) , X0=2
set.seed(1234)
X <- OU(N=1000,M=10,mu = 4,sigma = 1,x0=10)
plot(X,plot.type="single")
lines(as.vector(time(X)),rowMeans(X),col="red")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.