Simulate approximate solution of diagonal-drift HWV processes
[Paths,Times,Z] = simBySolution(MDL,NPeriods)
[Paths,Times,Z] = simBySolution(___,Name,Value)
hwv object to represent the model:
hwv = hwv(0.2, 0.1, 0.05) % (Speed, Level, Sigma)
hwv = 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
simBySolution function 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
nPeriods = 100 [Paths,Times,Z] = simBySolution(hwv, nPeriods,'nTrials', 10);
MDL— Hull-White/Vasicek (HWV) model
Hull-White/Vasicek (HWV) mode, specified as a
hwv object that is
NPeriods— Number of simulation periods
Number of simulation periods, specified as a positive scalar integer. The value of
NPeriods determines the number of rows of the simulated output
comma-separated pairs of
the argument name and
Value is the corresponding value.
Name must appear inside quotes. You can specify several name and value
pair arguments in any order as
[Paths,Times,Z] = simBySolution(HWV,NPeriods,'DeltaTime',dt,'NTrials',10)
'NTrials'— Simulated trials (sample paths) of
1(single path of correlated state variables) (default) | positive integer
Simulated trials (sample paths) of
NPERIODS observations each,
specified as the comma-separated pair consisting of
'NTrials' and a
positive scalar integer.
'DeltaTimes'— Positive time increments between observations
1(default) | scalar | column vector
Positive time increments between observations, specified as the comma-separated
pair consisting of
'DeltaTimes' and a scalar or a
1 column vector.
DeltaTime represents the familiar dt found in
stochastic differential equations, and determines the times at which the simulated
paths of the output state variables are reported.
'NSteps'— Number of intermediate time steps within each time increment dt (specified as
1(indicating no intermediate evaluation) (default) | positive integer
Number of intermediate time steps within each time increment dt
DeltaTime), specified as the comma-separated pair
'NSteps' and a positive scalar integer.
simBySolution function partitions each time increment
NSteps subintervals of length
NSteps, and refines the simulation by
evaluating the simulated state vector at
NSteps − 1 intermediate
simBySolution does not report the output state
vector at these intermediate points, the refinement improves accuracy by allowing the
simulation to more closely approximate the underlying continuous-time process.
'Antithetic'— Flag to indicate whether
simBySolutionuses antithetic sampling to generate the Gaussian random variates
False(no antithetic sampling) (default) | logical with values
Flag to indicate whether
simBySolution uses antithetic sampling
to generate the Gaussian random variates that drive the Brownian motion vector (Wiener
processes), specified as the comma-separated pair consisting of
'Antithetic' and a scalar logical flag with a value of
When you specify
performs sampling such that all primary and antithetic paths are simulated and stored
in successive matching pairs:
(1,3,5,...) correspond to the primary Gaussian
(2,4,6,...) are the matching antithetic paths
of each pair derived by negating the Gaussian draws of the corresponding primary
If you specify an input noise process (see
simBySolution ignores the value of
'Z'— Direct specification of the dependent random noise process used to generate the Brownian motion vector
Correlationmember of the
SDEobject (default) | function | three-dimensional array of dependent random variates
Direct specification of the dependent random noise process used to generate the
Brownian motion vector (Wiener process) that drives the simulation, specified as the
comma-separated pair consisting of
'Z' and a function or as an
three-dimensional array of dependent random variates.
The input argument
Z allows you to directly specify the noise
generation process. This process takes precedence over the
Correlation parameter of the input
gbm object and the value of the
If you specify
Z as a function, it must return an
1 column vector, and you must
call it with two inputs:
A real-valued scalar observation time t.
1 state vector
'StorePaths'— Flag that indicates how the output array
Pathsis stored and returned
True(default) | logical with values
Flag that indicates how the output array
Paths is stored and
returned, specified as the comma-separated pair consisting of
'StorePaths' and a scalar logical flag with a value of
True (the default value)
or is unspecified,
as a three-dimensional time series array.
simBySolution returns the
Paths output array as an empty matrix.
'Processes'— Sequence of end-of-period processes or state vector adjustments of the form
simBySolutionmakes no adjustments and performs no processing (default) | function | cell array of functions
Sequence of end-of-period processes or state vector adjustments of the form,
specified as the comma-separated pair consisting of
a function or cell array of functions of the form
simBySolution function runs processing functions at each
interpolation time. They must accept the current interpolation time
t, and the current state vector
Xt, and return a state vector that may
be an adjustment to the input state.
simBySolution applies processing functions at the end of each
observation period. These functions must accept the current observation time
t and the current state vector
Xt, and return a
state vector that may be an adjustment to the input state.
Processes argument allows you to terminate a
given trial early. At the end of each time step,
tests the state vector Xt for an
NaN condition. Thus, to signal an early termination of a
given trial, all elements of the state vector
Xt must be
test enables a user-defined
Processes function to signal early
termination of a trial, and offers significant performance benefits in some situations
(for example, pricing down-and-out barrier options).
If you specify more than one processing function,
invokes the functions in the order in which they appear in the cell array. You can use
this argument to specify boundary conditions, prevent negative prices, accumulate
statistics, plot graphs, and more.
Paths— Simulated paths of correlated state variables
Simulated paths of correlated state variables, returned as a
three-dimensional time series array.
For a given trial, each row of
Paths is the transpose of the
state vector Xt at time
t. When the input flag
Paths as an empty matrix.
Times— Observation times associated with the simulated paths
Observation times associated with the simulated paths, returned as a
(NPERIODS + 1)-by-
1 column vector. Each element
Times is associated with the corresponding row of
Z— Dependent random variates used to generate the Brownian motion vector
Dependent random variates used to generate the Brownian motion vector (Wiener
processes) that drive the simulation, returned as a
three-dimensional time series array.
Simulation methods allow you to specify a popular variance reduction technique called antithetic sampling.
This technique attempts to replace one sequence of random observations with another of the same expected value, but smaller variance. In a typical Monte Carlo simulation, each sample path is independent and represents an independent trial. However, antithetic sampling generates sample paths in pairs. The first path of the pair is referred to as the primary path, and the second as the antithetic path. Any given pair is independent of any other pair, but the two paths within each pair are highly correlated. Antithetic sampling literature often recommends averaging the discounted payoffs of each pair, effectively halving the number of Monte Carlo trials.
This technique attempts to reduce variance by inducing negative dependence between paired input samples, ideally resulting in negative dependence between paired output samples. The greater the extent of negative dependence, the more effective antithetic sampling is.
simBySolution method simulates
NVARS correlated state variables, driven by
NBROWNS Brownian motion sources of risk over
consecutive observation periods, approximating continuous-time Hull-White/Vasicek (HWV) by an
approximation of the closed-form solution.
Consider a separable, vector-valued HWV model of the form:
X is an NVARS-by-
vector of process variables.
S is an NVARS-by-NVARS matrix of mean reversion speeds (the rate of mean reversion).
L is an NVARS-by-
of mean reversion levels (long-run mean or level).
V is an NVARS-by-NBROWNS instantaneous volatility rate matrix.
W is an NBROWNS-by-
Brownian motion vector.
simBySolution method simulates the state vector
Xt using an approximation of the closed-form
solution of diagonal-drift models.
When evaluating the expressions,
simBySolution assumes that all model
parameters are piecewise-constant over each simulation period.
In general, this is not the exact solution to the models, because the probability distributions of the simulated and true state vectors are identical only for piecewise-constant parameters.
When parameters are piecewise-constant over each observation period, the simulated process is exact for the observation times at which Xt is sampled.
Gaussian diffusion models, such as
hwv, allow negative states. By default,
nothing to prevent negative states, nor does it guarantee that the model be strictly
mean-reverting. Thus, the model may exhibit erratic or explosive growth.
 Ait-Sahalia, Y. “Testing Continuous-Time Models of the Spot Interest Rate.” The Review of Financial Studies, Spring 1996, Vol. 9, No. 2, pp. 385–426.
 Ait-Sahalia, Y. “Transition Densities for Interest Rate and Other Nonlinear Diffusions.” The Journal of Finance, Vol. 54, No. 4, August 1999.
 Glasserman, P. Monte Carlo Methods in Financial Engineering. New York, Springer-Verlag, 2004.
 Hull, J. C. Options, Futures, and Other Derivatives, 5th ed. Englewood Cliffs, NJ: Prentice Hall, 2002.
 Johnson, N. L., S. Kotz, and N. Balakrishnan. Continuous Univariate Distributions. Vol. 2, 2nd ed. New York, John Wiley & Sons, 1995.
 Shreve, S. E. Stochastic Calculus for Finance II: Continuous-Time Models. New York: Springer-Verlag, 2004.