fbpx

Matlab: Creating Stochastic Differential Equations from Mean-Reverting Drift Cox-Ingersoll-Ross (CIR) Square Root Diffusion Models

(Last Updated On: August 2, 2010)

From the Matlab Economtric toolbox help:

Creating Stochastic Differential Equations from Mean-Reverting Drift (SDEMRD) Models

The SDEMRD class derives directly from the SDEDDO class. It provides an interface in which the drift-rate function is expressed in mean-reverting drift form:

SDEMRD objects provide a parametric alternative to the linear drift form by reparameterizing the general linear drift such that:

Example: SDEMRD Models. Create an SDEMRD object obj with a square root exponent to represent the model:

obj = sdemrd(0.2, 0.1, 0.5, 0.05) % (Speed, Level, Alpha, Sigma)
obj =
Class SDEMRD: SDE with Mean-Reverting Drift
——————————————-
Dimensions: State = 1, Brownian = 1
——————————————-
StartTime: 0
StartState: 1
Correlation: 1
Drift: drift rate function F(t,X(t))
Diffusion: diffusion rate function G(t,X(t))
Simulation: simulation method/function simByEuler
Alpha: 0.5
Sigma: 0.05
Level: 0.1
Speed: 0.2

SDEMRD objects display the familiar Speed and Level parameters instead of A and B.

Creating Cox-Ingersoll-Ross (CIR) Square Root Diffusion Models

The Cox-Ingersoll-Ross (CIR) short rate class derives directly from SDE with mean-reverting drift (SDEMRD):

where D is a diagonal matrix whose elements are the square root of the corresponding element of the state vector.

Example: CIR Models. Create a CIR object to represent the same model as in Example: SDEMRD Models:

obj = cir(0.2, 0.1, 0.05) % (Speed, Level, Sigma)
obj =
Class CIR: Cox-Ingersoll-Ross
—————————————-
Dimensions: State = 1, Brownian = 1
—————————————-
StartTime: 0
StartState: 1
Correlation: 1
Drift: drift rate function F(t,X(t))
Diffusion: diffusion rate function G(t,X(t))
Simulation: simulation method/function simByEuler
Sigma: 0.05
Level: 0.1
Speed: 0.2

Although the last two objects are of different classes, they represent the same mathematical model. They differ in that you create the CIR object by specifying only three input arguments. This distinction is reinforced by the fact that the Alpha parameter does not display – it is defined to be 1/2.

reating Hull-White/Vasicek (HWV) Gaussian Diffusion Models

The Hull-White/Vasicek(HWV) short rate class derives directly from SDE with mean-reverting drift (that is, SDEMRD):

Example: HWV Models. Using the same parameters as in the previous example, create an HWV object to represent the model:

obj = hwv(0.2, 0.1, 0.05) % (Speed, Level, Sigma)
obj =
Class HWV: Hull-White/Vasicek
—————————————-
Dimensions: State = 1, Brownian = 1
—————————————-
StartTime: 0
StartState: 1
Correlation: 1
Drift: drift rate function F(t,X(t))
Diffusion: diffusion rate function G(t,X(t))
Simulation: simulation method/function simByEuler
Sigma: 0.05
Level: 0.1
Speed: 0.2

CIR and HWV constructors share the same interface and display methods. The only distinction is that CIR and HWV models constrain Alpha exponents to 1/2 and 0, respectively. Furthermore, the HWV class also provides an additional method that simulates approximate analytic solutions (simBySolution) of separable models. This method simulates the state vector Xt using an approximation of the closed-form solution of diagonal drift HWV models. Each element of the state vector Xt is expressed as the sum of NBROWNS correlated Gaussian random draws added to a deterministic time-variable drift.

When evaluating expressions, all model parameters are assumed piecewise constant over each simulation period. In general, this is not the exact solution to this HWV model, because the probability distributions of the simulated and true state vectors are identical only for piecewise constant parameters. If S(t,Xt), L(t,Xt), and V(t,Xt) are piecewise constant over each observation period, the state vector Xt is normally distributed, and the simulated process is exact for the observation times at which Xt is sampled.

Hull-White vs. Vasicek Models. Many references differentiate between Vasicek models and Hull-White models. Where such distinctions are made, Vasicek parameters are constrained to be constants, while Hull-White parameters vary deterministically with time. Think of Vasicek models in this context as constant-coefficient Hull-White models and equivalently, Hull-White models as time-varying Vasicek models. However, from an architectural perspective, the distinction between static and dynamic parameters is trivial. Since both models share the same general parametric specification as previously described, a single HWV class encompasses the models.

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

Subscribe For Latest Updates

Sign up to best of business news, informed analysis and opinions on what matters to you.
Invalid email address
We promise not to spam you. You can unsubscribe at any time.

NOTE!

Check NEW site on stock forex and ETF analysis and automation

Scroll to Top