Documentation |
The Brownian Motion (BM) model derives directly from the linear drift (SDELD) class:
$$d{X}_{t}=\mu (t)dt+V(t)d{W}_{t}$$
Create a univariate Brownian motion (BM) object to represent the model:
$$d{X}_{t}=0.3d{W}_{t}.$$
obj = bm(0, 0.3) % (A = Mu, Sigma)
obj = Class BM: Brownian Motion ---------------------------------------- Dimensions: State = 1, Brownian = 1 ---------------------------------------- StartTime: 0 StartState: 0 Correlation: 1 Drift: drift rate function F(t,X(t)) Diffusion: diffusion rate function G(t,X(t)) Simulation: simulation method/function simByEuler Mu: 0 Sigma: 0.3
BM objects display the parameter A as the more familiar Mu.
The BM class also provides an overloaded Euler simulation method that improves run time performance in certain common situations. This specialized method is invoked automatically only if all of the following conditions are met:
The expected drift, or trend, rate Mu is a column vector.
The volatility rate, Sigma, is a matrix.
No end-of-period adjustments and/or processes are made.
If specified, the random noise process Z is a three-dimensional array.
If Z is unspecified, the assumed Gaussian correlation structure is a double matrix.
The Constant Elasticity of Variance (CEV) model also derives directly from the linear drift (SDELD) class:
$$d{X}_{t}=\mu (t){X}_{t}dt+D(t,{X}_{t}^{\alpha (t)})V(t)d{W}_{t}$$
The CEV class constrains A to an NVARS-by-1 vector of zeros. D is a diagonal matrix whose elements are the corresponding element of the state vector X, raised to an exponent α(t).
Create a univariate CEV object to represent the model:
$$d{X}_{t}=0.25{X}_{t}+0.3{X}_{t}^{\frac{1}{2}}d{W}_{t}.$$
obj = cev(0.25, 0.5, 0.3) % (B = Return, Alpha, Sigma)
obj = Class CEV: Constant Elasticity of Variance ------------------------------------------ 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 Return: 0.25 Alpha: 0.5 Sigma: 0.3
CEV and GBM objects display the parameter B as the more familiar Return.
The Geometric Brownian Motion (GBM) model derives directly from the CEV model:
$$d{X}_{t}=\mu (t){X}_{t}dt+D(t,{X}_{t})V(t)d{W}_{t}$$
Compared to CEV, GBM constrains all elements of the alpha exponent vector to one such that D is now a diagonal matrix with the state vector X along the main diagonal.
The GBM class also provides two simulation methods that can be used by separable models:
An overloaded Euler simulation method that improves run time performance in certain common situations. This specialized method is invoked automatically only if all of the following conditions are true:
The expected rate of return (Return) is a diagonal matrix.
The volatility rate (Sigma) is a matrix.
No end-of-period adjustments/processes are made.
If specified, the random noise process Z is a three-dimensional array.
If Z is unspecified, the assumed Gaussian correlation structure is a double matrix.
An approximate analytic solution (simBySolution) obtained by applying an Euler approach to the transformed (using Ito's formula) logarithmic process. In general, this is not the exact solution to this GBM model, as the probability distributions of the simulated and true state vectors are identical only for piecewise constant parameters. If the model parameters are piecewise constant over each observation period, the state vector X_{t} is lognormally distributed and the simulated process is exact for the observation times at which X_{t} is sampled.
Create a univariate GBM object to represent the model:
$$d{X}_{t}=0.25{X}_{t}dt+0.3{X}_{t}d{W}_{t}$$
obj = gbm(0.25, 0.3) % (B = Return, Sigma)
obj = Class GBM: Generalized Geometric Brownian Motion ------------------------------------------------ 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 Return: 0.25 Sigma: 0.3
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:
$$d{X}_{t}=S(t)[L(t)-{X}_{t}]dt+D(t,{X}_{t}^{\alpha (t)})V(t)d{W}_{t}$$
SDEMRD objects provide a parametric alternative to the linear drift form by reparameterizing the general linear drift such that:
$$A(t)=S(t)L(t),B(t)=-S(t)$$
Create an SDEMRD object obj with a square root exponent to represent the model:
$$d{X}_{t}=0.2(0.1-{X}_{t})dt+0.05{X}_{t}^{\frac{1}{2}}d{W}_{t}.$$
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.
The Cox-Ingersoll-Ross (CIR) short rate class derives directly from SDE with mean-reverting drift (SDEMRD):
$$d{X}_{t}=S(t)[L(t)-{X}_{t}]dt+D(t,{X}_{t}^{\frac{1}{2}})V(t)d{W}_{t}$$
where D is a diagonal matrix whose elements are the square root of the corresponding element of the state vector.
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.
The Hull-White/Vasicek(HWV) short rate class derives directly from SDE with mean-reverting drift (that is, SDEMRD):
$$d{X}_{t}=S(t)[L(t)-{X}_{t}]dt+V(t)d{W}_{t}$$
Using the same parameters as in the previous example, create an HWV object to represent the model:
$$d{X}_{t}=0.2(0.1-{X}_{t})dt+0.05d{W}_{t}.$$
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 X_{t} using an approximation of the closed-form solution of diagonal drift HWV models. Each element of the state vector X_{t} 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,X_{t}), L(t,X_{t}), and V(t,X_{t}) are piecewise constant over each observation period, the state vector X_{t} is normally distributed, and the simulated process is exact for the observation times at which X_{t} is sampled.
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.
The Heston (heston) class derives directly from SDE from Drift and Diffusion (SDEDDO). Each Heston model is a bivariate composite model, consisting of two coupled univariate models:
$$d{X}_{1t}=B(t){X}_{1t}dt+\sqrt{{X}_{2t}}{X}_{1t}d{W}_{1t}$$ | (17-5) |
$$d{X}_{2t}=S(t)[L(t)-{X}_{2t}]dt+V(t)\sqrt{{X}_{2t}}d{W}_{2t}$$ | (17-6) |
Equation 17-5 is typically associated with a price process. Equation 17-6 represents the evolution of the price process' variance. Models of type heston are typically used to price equity options.
Create a heston object to represent the model:
$$\begin{array}{l}d{X}_{1t}=0.1{X}_{1t}dt+\sqrt{{X}_{2t}}{X}_{1t}d{W}_{1t}\\ d{X}_{2t}=0.2[0.1-{X}_{2t}]dt+0.05\sqrt{{X}_{2t}}d{W}_{2t}\end{array}$$
obj = heston (0.1, 0.2, 0.1, 0.05)
obj = Class HESTON: Heston Bivariate Stochastic Volatility ---------------------------------------------------- Dimensions: State = 2, Brownian = 2 ---------------------------------------------------- StartTime: 0 StartState: 1 (2x1 double array) Correlation: 2x2 diagonal double array Drift: drift rate function F(t,X(t)) Diffusion: diffusion rate function G(t,X(t)) Simulation: simulation method/function simByEuler Return: 0.1 Speed: 0.2 Level: 0.1 Volatility: 0.05