Main Content

simByHybrid

Simulate RVM or roughbergomi sample paths by hybrid approximation

Since R2023b

Description

example

[Paths,Times,Z] = simByHybrid(MDL,NPeriods) simulates NTrials sample paths of NVars correlated state variables driven by NBrowns Brownian motion sources of risk over NPeriods consecutive observation periods. simByHybrid uses the hybrid scheme to approximate continuous-time stochastic processes.

example

[Paths,Times,Z] = simByHybrid(___,Name=Value) specifies options using one or more name-value arguments in addition to the input arguments in the previous syntax.

You can perform quasi-Monte Carlo simulations using the name-value arguments for MonteCarloMethod, QuasiSequence, and BrownianMotionMethod. For more information, see Quasi-Monte Carlo Simulation.

Examples

collapse all

The rough volatility model (RVM) in a rvm object is a bivariate composite model, composed of two coupled and dissimilar univariate models, each driven by a single Brownian motion source of risk over NPeriods consecutive observation periods, approximating continuous-time rough stochastic volatility processes.

Create a rvm object.

Return = 0.03;
Volatility = 0.2;
Alpha = 0.03;
Beta = 0.015;

            
rvmObj = rvm(Return,Volatility,Alpha,Beta,KernelType="gamma")
rvmObj = 
   Class RVM: Rough Stochastic Volatility
   ----------------------------------------
     Dimensions: State = 2, Brownian = 2
   ----------------------------------------
      StartTime: 0
     StartState: 1 (2x1 double array) 
    Correlation: 2x2 diagonal double array 
         Return: 0.03
     Volatility: 0.2
         Kernel: gamma
          Alpha: 0.03
           Beta: 0.015

Use simByHybrid to simulate NTrials sample paths of NVars correlated state variables driven by NBrowns Brownian motion sources of risk over NPeriods consecutive observation periods. The function simByHybrid approximates a continuous-time stochastic process by the Hybrid scheme.

NPeriods = 2;
[Paths,Times,Z] = simByHybrid(rvmObj,NPeriods,DeltaTime=0.03,NSteps=10)
Paths = 3×2

    1.0000    1.0000
    1.2757    1.0429
    1.2948    1.0086

Times = 3×1

         0
    0.0300
    0.0600

Z = 20×3

    0.0294    0.1005    0.0790
    0.0472    0.0175    0.0125
   -0.0237    0.0188    0.0200
    0.1517   -0.0740   -0.0564
    0.0397   -0.0035   -0.0019
   -0.0112   -0.0068   -0.0036
    0.0772    0.0777    0.0642
   -0.0661    0.0393    0.0342
    0.0268    0.0567    0.0472
   -0.0166    0.0161    0.0121
      ⋮

Paths is a 3-by-2 matrix of the simulated paths of state variables and the output Z is a matrix of random variates used to generate the Brownian motion vector.

The rough Bergomi model is a roughbergomi object that is a bivariate composite model, composed of two coupled and dissimilar univariate models, each driven by a single Brownian motion source of risk over NPeriods consecutive observation periods, approximating continuous-time rough stochastic volatility processes.

Create a roughbergomi object.

Return = 0.03;
Alpha = -0.03;
Xi = 0.2;
Eta = 0.015;

roughbergomiObj = roughbergomi(Return,Alpha,Xi,Eta)
roughbergomiObj = 
   Class ROUGHBERGOMI: Rough Bergomi
   ----------------------------------------
     Dimensions: State = 2, Brownian = 2
   ----------------------------------------
      StartTime: 0
     StartState: 1 (2x1 double array) 
    Correlation: 2x2 diagonal double array 
         Return: 0.03
          Alpha: -0.03
             Xi: 0.2
            Eta: 0.015

Use simByHybrid to simulate NTrials sample paths of NVars correlated state variables driven by NBrowns Brownian motion sources of risk over NPeriods consecutive observation periods. The function simByHybrid approximates a continuous-time stochastic process by the Hybrid scheme.

NPeriods = 2;
[Paths,Times,Z] = simByHybrid(roughbergomiObj,NPeriods,DeltaTime=0.03,NSteps=10)
Paths = 3×2

    1.0000    0.2000
    1.1182    0.2008
    1.1301    0.2001

Times = 3×1

         0
    0.0300
    0.0600

Z = 20×3

    0.0294    0.1005    0.1186
    0.0472    0.0175    0.0187
   -0.0237    0.0188    0.0305
    0.1517   -0.0740   -0.0845
    0.0397   -0.0035   -0.0028
   -0.0112   -0.0068   -0.0052
    0.0772    0.0777    0.0967
   -0.0661    0.0393    0.0516
    0.0268    0.0567    0.0711
   -0.0166    0.0161    0.0181
      ⋮

Paths is a 3-by-2 matrix of the simulated paths of state variables and the output Z is a matrix of random variates used to generate the Brownian motion vector.

Input Arguments

collapse all

Stochastic differential equation model, specified as an rvm object or roughbergomi object.

Data Types: object

Number of simulation periods, specified as a positive scalar integer. The value of NPeriods determines the number of rows of the simulated output series.

Data Types: double

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: [Paths,Times,Z] = simByHybrid(rvm,NPeriods,DeltaTime=dt)

Simulated trials (sample paths) of NPeriods observations each, specified as a positive scalar integer.

Data Types: double

Positive time increments between observations, specified as a positive scalar numeric.

DeltaTime represents the dt found in stochastic differential equations and determines the times at which the simulated paths of the output state variables are reported.

Data Types: double

Number of intermediate time steps within each time increment dt (specified as DeltaTime), specified as a positive scalar integer.

The simByHybrid function partitions each time increment dt into NSteps subintervals of length dt/NSteps, and refines the simulation by evaluating the simulated state vector at NSteps − 1 intermediate points. Although simByHybrid 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.

Data Types: double

Flag that indicates whether simByHybrid uses Antithetic Sampling to generate the Gaussian random variates that drive the Brownian motion vector (Wiener processes). This argument is specified as a scalar logical flag with a value of True or False.

When you specify True, simByHybrid performs sampling such that all primary and antithetic paths are simulated and stored in successive matching pairs:

  • Odd trials (1,3,5,...) correspond to the primary Gaussian paths.

  • Even trials (2,4,6,...) are the matching antithetic paths of each pair derived by negating the Gaussian draws of the corresponding primary (odd) trial.

Note

If you specify an input noise process (see Z), simByHybrid ignores the value of Antithetic.

Data Types: logical

Monte Carlo method to simulate stochastic processes, specified as a string or character vector with one of the following values:

  • "standard" — Monte Carlo using pseudo random numbers

  • "quasi" — Quasi-Monte Carlo using low-discrepancy sequences

  • "randomized-quasi" — Randomized quasi-Monte Carlo

Note

If you specify an input noise process (see Z), simByHybrid ignores the value of MonteCarloMethod.

Data Types: string | char

Low discrepancy sequence to drive the stochastic processes, specified as a string or character vector with the following value:

  • "sobol" — Quasi-random low-discrepancy sequences that use a base of two to form successively finer uniform partitions of the unit interval and then reorder the coordinates in each dimension.

Note

If you do not specify MonteCarloMethod or if you do not specify it as "standard", simByHybrid ignores QuasiSequence.

Data Types: string | char

Brownian motion construction method, specified as a string or character vector with one of the following values:

  • "standard" — The Brownian motion path is found by taking the cumulative sum of the Gaussian variates.

  • "brownian-bridge" — The last step of the Brownian motion path is calculated first, followed by any order between steps until all steps have been determined.

  • "principal-components" — The Brownian motion path is calculated by minimizing the approximation error.

Note

If an input noise process is specified using the Z input argument, BrownianMotionMethod is ignored.

The starting point for a Monte Carlo simulation is the construction of a Brownian motion sample path (or Wiener path). Such paths are built from a set of independent Gaussian variates, using either standard discretization, Brownian-bridge construction, or principal components construction.

Both standard discretization and Brownian-bridge construction share the same variance and, therefore, the same resulting convergence when used with the MonteCarloMethod using pseudo random numbers. However, the performance differs between the two when the MonteCarloMethod option "quasi" is introduced, with faster convergence for the "brownian-bridge" construction option and the fastest convergence for the "principal-components" construction option.

Data Types: string | char

Direct specification of the dependent random noise process used to generate the Brownian motion vector (Wiener process) that drives the simulation. This argument is specified as a function or as an (NPeriods ⨉ NSteps)-by-NBrowns-by-NTrials three-dimensional array of dependent random variates.

Data Types: double

Flag that indicates how the output array Paths is stored and returned, specified as a scalar logical flag with a value of True or False.

  • If StorePaths is True (the default value) or is unspecified, simByHybrid returns Paths as a three-dimensional time series array.

  • If StorePaths is False (logical 0), simByHybrid returns the Paths output array as an empty matrix.

Data Types: logical

Sequence of end-of-period processes or state vector adjustments, specified as a function or cell array of functions of the form

Xt=P(t,Xt)

The simByHybrid function runs processing functions at each observation period. They 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.

If you specify more than one processing function, simByHybrid 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, and plot graphs.

Data Types: cell | function

Output Arguments

collapse all

Simulated paths of correlated state variables, returned as an (NPeriods + 1)-by-NVars-by-NTrials three-dimensional time series array.

For a given trial, each row of Paths is the transpose of the state vector Xt at time t for a given trial. When the input flag StorePaths is False, simByHybrid returns Paths as an empty matrix.

Note

The second state variable in the rough volatility model is volatility (not variance).

Observation times associated with the simulated paths, returned as an (NPeriods + 1)-by-1 column vector. Each element of Times is associated with the corresponding row of Paths.

Dependent random variates used to generate the Brownian motion vector (Wiener processes) that drive the simulation, returned as a (NPeriods ⨉ NSteps)-by-NBrowns-by-NTrials three-dimensional time series array.

More About

collapse all

Antithetic Sampling

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.

Algorithms

This function simulates any vector-valued SDE of the form

dXt=F(t,Xt)dt+G(t,Xt)dWt

where:

  • X is an NVars-by-1 state vector of process variables (for example, short rates or equity prices) to simulate.

  • W is an NBrowns-by-1 Brownian motion vector.

  • F is an NVars-by-1 vector-valued drift-rate function.

  • G is an NVars-by-NBrowns matrix-valued diffusion-rate function.

simByHybrid simulates NTrials sample paths of NVars correlated state variables driven by NBrowns Brownian motion sources of risk over NPeriods consecutive observation periods, using the hybrid method to approximate continuous-time stochastic processes.

  • This simulation engine provides a discrete-time approximation of the underlying generalized continuous-time process. The simulation is derived directly from the stochastic differential equation of motion. Thus, the discrete-time process approaches the true continuous-time process only as DeltaTime approaches zero.

  • The input argument Z allows you to directly specify the noise-generation process. This process takes precedence over the Correlation parameter of the rvm or roughbergomi object and the value of the Antithetic input flag and the QuasiMonteCarlo argument. If you do not specify a value for Z, simByHybrid generates correlated Gaussian variates, with or without antithetic sampling as requested.

  • The end-of-period Processes argument allows you to terminate a given trial early. At the end of each time step, simByHybrid tests the state vector Xt for an all-NaN condition. Thus, to signal an early termination of a given trial, all elements of the state vector Xt must be NaN. This 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).

References

[1] Bennedsen, M., A. Lunde and M.S. Pakkanen. “Hybrid Scheme for Brownian Semistationary.” Finance and Stochastics, 2017, Vol. 21, No. 4, pp. 931–965.

Version History

Introduced in R2023b

expand all