# simBySolution

Simulate approximate solution of diagonal-drift `Merton`

jump
diffusion process

*Since R2020a*

## Syntax

## Description

`[`

simulates `Paths`

,`Times`

,`Z`

,`N`

] = simBySolution(`MDL`

,`NPeriods`

)`NNTrials`

sample paths of `NVars`

correlated state variables driven by `NBrowns`

Brownian motion
sources of risk and `NJumps`

compound Poisson processes
representing the arrivals of important events over `NPeriods`

consecutive observation periods. The simulation approximates continuous-time Merton
jump diffusion process by an approximation of the closed-form solution.

`[`

specifies options using one or more name-value pair arguments in addition to the
input arguments in the previous syntax. `Paths`

,`Times`

,`Z`

,`N`

] = simBySolution(___,`Name,Value`

)

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

### Use simBySolution with `merton`

Object

Simulate the approximate solution of diagonal-drift Merton process.

Create a `merton`

object.

AssetPrice = 80; Return = 0.03; Sigma = 0.16; JumpMean = 0.02; JumpVol = 0.08; JumpFreq = 2; mertonObj = merton(Return,Sigma,JumpFreq,JumpMean,JumpVol,... 'startstat',AssetPrice)

mertonObj = Class MERTON: Merton Jump Diffusion ---------------------------------------- Dimensions: State = 1, Brownian = 1 ---------------------------------------- StartTime: 0 StartState: 80 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.16 Return: 0.03 JumpFreq: 2 JumpMean: 0.02 JumpVol: 0.08

Use `simBySolution`

to simulate `NTrials`

sample paths of `NVARS`

correlated state variables driven by `NBrowns`

Brownian motion sources of risk and `NJumps`

compound Poisson processes representing the arrivals of important events over `NPeriods`

consecutive observation periods. The function approximates continuous-time Merton jump diffusion process by an approximation of the closed-form solution.

```
nPeriods = 100;
[Paths,Times,Z,N] = simBySolution(mertonObj, nPeriods,'nTrials', 3)
```

Paths = Paths(:,:,1) = 1.0e+03 * 0.0800 0.0600 0.0504 0.0799 0.1333 0.1461 0.2302 0.2505 0.3881 0.4933 0.4547 0.4433 0.5294 0.6443 0.7665 0.6489 0.7220 0.7110 0.5815 0.5026 0.6523 0.7005 0.7053 0.4902 0.5401 0.4730 0.4242 0.5334 0.5821 0.6498 0.5982 0.5504 0.5290 0.5371 0.4789 0.4914 0.5019 0.3557 0.2950 0.3697 0.2906 0.2988 0.3081 0.3469 0.3146 0.3171 0.3588 0.3250 0.3035 0.2386 0.2533 0.2420 0.2315 0.2396 0.2143 0.2668 0.2115 0.1671 0.1784 0.1542 0.2046 0.1930 0.2011 0.2542 0.3010 0.3247 0.3900 0.4107 0.3949 0.4610 0.5725 0.5605 0.4541 0.5796 0.8199 0.5732 0.5856 0.7895 0.6883 0.6848 0.9059 1.0089 0.8429 0.9955 0.9683 0.8769 0.7120 0.7906 0.7630 1.2460 1.1703 1.2012 1.1109 1.1893 1.4346 1.4040 1.2365 1.0834 1.3315 0.8100 0.5558 Paths(:,:,2) = 80.0000 81.2944 71.3663 108.8305 111.4851 105.4563 160.2721 125.3288 158.3238 138.8899 157.9613 125.6819 149.8234 126.0374 182.5153 195.0861 273.1622 306.2727 301.3401 312.2173 298.2344 327.6944 288.9799 394.8951 551.4020 418.2258 404.1687 469.3555 606.4289 615.7066 526.6862 625.9683 474.4597 316.5110 407.9626 341.6552 475.0593 478.4058 545.3414 365.3404 513.2186 370.5371 444.0345 314.6991 257.4782 253.0259 237.6185 206.6325 334.5253 300.2284 328.9936 307.4059 248.7966 234.6355 183.9132 159.6084 169.1145 123.3256 148.1922 159.7083 104.0447 96.3935 92.4897 93.0576 116.3163 135.6249 120.6611 100.0253 109.7998 85.8078 81.5769 73.7983 65.9000 62.5120 62.9952 57.6044 54.2716 44.5617 42.2402 21.9133 18.0586 20.5171 22.5532 24.1654 26.8830 22.7864 34.5131 27.8362 27.7258 21.7367 20.8781 19.7174 14.9880 14.8903 19.3632 23.4230 27.7062 17.8347 16.8652 15.5675 15.5256 Paths(:,:,3) = 80.0000 79.6263 93.2979 63.1451 60.2213 54.2113 78.6114 96.6261 123.5584 126.5875 102.9870 83.2387 77.8567 79.3565 71.3876 80.5413 90.8709 77.5246 107.4194 114.4328 118.3999 148.0710 108.6207 110.0402 124.1150 104.5409 94.7576 98.9002 108.0691 130.7592 129.9744 119.9150 86.0303 96.9892 86.8928 106.8895 119.3219 197.7045 208.1930 197.1636 244.4438 166.4752 125.3896 128.9036 170.9818 140.2719 125.8948 87.0324 66.7637 48.4280 50.5766 49.7841 67.5690 62.8776 85.3896 67.9608 72.9804 59.0174 50.1132 45.2220 59.5469 58.4673 98.4790 90.0250 80.3092 86.9245 88.1303 95.4237 104.4456 99.1969 168.3980 146.8791 150.0052 129.7521 127.1402 113.3413 145.2281 153.1315 125.7882 111.9988 112.7732 118.9120 150.9166 120.0673 128.2727 185.9171 204.3474 194.5443 163.2626 183.9897 233.4125 318.9068 356.0077 380.4513 446.9518 484.9218 377.4244 470.3577 454.5734 297.0580 339.0796

`Times = `*101×1*
0
1
2
3
4
5
6
7
8
9
⋮

Z = Z(:,:,1) = -2.2588 -1.3077 3.5784 3.0349 0.7147 1.4897 0.6715 1.6302 0.7269 -0.7873 -1.0689 1.4384 1.3703 -0.2414 -0.8649 0.6277 -0.8637 -1.1135 -0.7697 1.1174 0.5525 0.0859 -1.0616 0.7481 -0.7648 0.4882 1.4193 1.5877 0.8351 -1.1658 0.7223 0.1873 -0.4390 -0.8880 0.3035 0.7394 -2.1384 -1.0722 1.4367 -1.2078 1.3790 -0.2725 0.7015 -0.8236 0.2820 1.1275 0.0229 -0.2857 -1.1564 0.9642 -0.0348 -0.1332 -0.2248 -0.8479 1.6555 -0.8655 -1.3320 0.3335 -0.1303 0.8620 -0.8487 1.0391 0.6601 -0.2176 0.0513 0.4669 0.1832 0.3071 0.2614 -0.1461 -0.8757 -1.1742 1.5301 1.6035 -1.5062 0.2761 0.3919 -0.7411 0.0125 1.2424 0.3503 -1.5651 0.0983 -0.0308 -0.3728 -2.2584 1.0001 -0.2781 0.4716 0.6524 1.0061 -0.9444 0.0000 0.5946 0.9298 -0.6516 -0.0245 0.8617 -2.4863 -2.3193 Z(:,:,2) = 0.8622 -0.4336 2.7694 0.7254 -0.2050 1.4090 -1.2075 0.4889 -0.3034 0.8884 -0.8095 0.3252 -1.7115 0.3192 -0.0301 1.0933 0.0774 -0.0068 0.3714 -1.0891 1.1006 -1.4916 2.3505 -0.1924 -1.4023 -0.1774 0.2916 -0.8045 -0.2437 -1.1480 2.5855 -0.0825 -1.7947 0.1001 -0.6003 1.7119 -0.8396 0.9610 -1.9609 2.9080 -1.0582 1.0984 -2.0518 -1.5771 0.0335 0.3502 -0.2620 -0.8314 -0.5336 0.5201 -0.7982 -0.7145 -0.5890 -1.1201 0.3075 -0.1765 -2.3299 0.3914 0.1837 -1.3617 -0.3349 -1.1176 -0.0679 -0.3031 0.8261 -0.2097 -1.0298 0.1352 -0.9415 -0.5320 -0.4838 -0.1922 -0.2490 1.2347 -0.4446 -0.2612 -1.2507 -0.5078 -3.0292 -1.0667 -0.0290 -0.0845 0.0414 0.2323 -0.2365 2.2294 -1.6642 0.4227 -1.2128 0.3271 -0.6509 -1.3218 -0.0549 0.3502 0.2398 1.1921 -1.9488 0.0012 0.5812 0.0799 Z(:,:,3) = 0.3188 0.3426 -1.3499 -0.0631 -0.1241 1.4172 0.7172 1.0347 0.2939 -1.1471 -2.9443 -0.7549 -0.1022 0.3129 -0.1649 1.1093 -1.2141 1.5326 -0.2256 0.0326 1.5442 -0.7423 -0.6156 0.8886 -1.4224 -0.1961 0.1978 0.6966 0.2157 0.1049 -0.6669 -1.9330 0.8404 -0.5445 0.4900 -0.1941 1.3546 0.1240 -0.1977 0.8252 -0.4686 -0.2779 -0.3538 0.5080 -1.3337 -0.2991 -1.7502 -0.9792 -2.0026 -0.0200 1.0187 1.3514 -0.2938 2.5260 -1.2571 0.7914 -1.4491 0.4517 -0.4762 0.4550 0.5528 1.2607 -0.1952 0.0230 1.5270 0.6252 0.9492 0.5152 -0.1623 1.6821 -0.7120 -0.2741 -1.0642 -0.2296 -0.1559 0.4434 -0.9480 -0.3206 -0.4570 0.9337 0.1825 1.6039 -0.7342 0.4264 2.0237 0.3376 -0.5900 -1.6702 0.0662 1.0826 0.2571 0.9248 0.9111 1.2503 -0.6904 -1.6118 1.0205 -0.0708 -2.1924 -0.9485

N = N(:,:,1) = 3 1 2 1 0 2 0 1 3 4 2 1 0 1 1 1 1 0 0 3 2 2 1 0 1 1 3 3 4 2 4 1 1 2 0 2 2 3 2 1 3 2 2 1 1 1 3 0 2 2 1 0 1 1 1 1 0 2 2 1 1 5 7 3 2 2 1 3 3 5 3 0 1 6 2 0 5 2 2 1 2 1 3 0 2 4 2 2 4 2 3 1 2 5 1 0 3 3 1 1 N(:,:,2) = 4 2 2 2 0 4 1 2 3 1 2 1 4 2 6 2 2 2 2 1 4 3 1 3 3 1 3 6 1 4 2 2 1 2 1 1 5 0 2 2 3 2 2 1 0 1 5 4 0 1 1 2 1 2 3 2 2 1 2 2 0 3 1 6 3 3 0 2 1 2 0 6 1 3 1 2 2 2 1 0 2 2 2 2 1 1 3 1 2 2 1 4 1 3 3 0 1 1 1 2 N(:,:,3) = 1 3 2 2 1 4 2 3 0 0 4 3 2 3 1 1 1 1 3 4 1 2 3 1 1 1 1 0 3 0 1 0 4 0 2 4 3 1 0 1 5 3 3 2 1 2 3 1 5 4 1 1 2 2 1 1 1 2 1 5 1 2 1 3 2 2 1 3 1 6 0 1 4 1 1 3 5 3 1 2 2 1 2 1 1 1 1 1 2 3 6 2 1 3 2 1 1 0 1 3

### Quasi-Monte Carlo Simulation Using Merton Model

This example shows how to use `simBySolution`

with a Merton model to perform a quasi-Monte Carlo simulation. Quasi-Monte Carlo simulation is a Monte Carlo simulation that uses quasi-random sequences instead pseudo random numbers.

Create a `merton`

object.

```
AssetPrice = 80;
Return = 0.03;
Sigma = 0.16;
JumpMean = 0.02;
JumpVol = 0.08;
JumpFreq = 2;
Merton = merton(Return,Sigma,JumpFreq,JumpMean,JumpVol,'startstat',AssetPrice)
```

Merton = Class MERTON: Merton Jump Diffusion ---------------------------------------- Dimensions: State = 1, Brownian = 1 ---------------------------------------- StartTime: 0 StartState: 80 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.16 Return: 0.03 JumpFreq: 2 JumpMean: 0.02 JumpVol: 0.08

Perform a quasi-Monte Carlo simulation by using `simBySolution`

with the optional name-value arguments for `'MonteCarloMethod'`

,`'QuasiSequence'`

, and `'BrownianMotionMethod'`

.

[paths,time,z,n] = simBySolution(Merton, 10,'ntrials',4096,'montecarlomethod','quasi','QuasiSequence','sobol','BrownianMotionMethod','brownian-bridge');

## Input Arguments

`MDL`

— Merton model

`merton`

object

Merton model, specified as a `merton`

object. You can
create a `merton`

object using `merton`

.

**Data Types: **`object`

`NPeriods`

— Number of simulation periods

positive integer

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.

*
Before R2021a, use commas to separate each name and value, and enclose*
`Name`

*in quotes.*

**Example: **```
[Paths,Times,Z,N] =
simBySolution(merton,NPeriods,'DeltaTime',dt,'NNTrials',10)
```

`NNTrials`

— Simulated NTrials (sample paths)

`1`

(single path of correlated state
variables) (default) | positive integer

Simulated NTrials (sample paths) of `NPeriods`

observations each, specified as the comma-separated pair consisting of
`'NNTrials'`

and a positive scalar integer.

**Data Types: **`double`

`DeltaTime`

— Positive time increments between observations

`1`

(default) | scalar | column vector

Positive time increments between observations, specified as the
comma-separated pair consisting of `'DeltaTime'`

and a
scalar or an `NPeriods`

-by-`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.

**Data Types: **`double`

`NSteps`

— Number of intermediate time steps within each time increment

`1`

(indicating no intermediate
evaluation) (default) | positive integer

Number of intermediate time steps within each time increment
*dt* (specified as `DeltaTime`

),
specified as the comma-separated pair consisting of
`'NSteps'`

and a positive scalar integer.

The `simBySolution`

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
`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.

**Data Types: **`double`

`Antithetic`

— Flag to use antithetic sampling to generate the Gaussian random variates

`false`

(no antithetic
sampling) (default) | logical with values `true`

or
`false`

Flag to use 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 numeric or logical
`1`

(`true`

) or
`0`

(`false`

).

When you specify `true`

,
`simBySolution`

performs sampling such that all
primary and antithetic paths are simulated and stored in successive
matching pairs:

Odd NTrials

`(1,3,5,...)`

correspond to the primary Gaussian paths.Even NTrials

`(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`

), `simBySolution`

ignores
the value of `Antithetic`

.

**Data Types: **`logical`

`MonteCarloMethod`

— Monte Carlo method to simulate stochastic processes

`"standard"`

(default) | string with values `"standard"`

,
`"quasi"`

, or
`"randomized-quasi"`

| character vector with values `'standard'`

,
`'quasi'`

, or
`'randomized-quasi'`

Monte Carlo method to simulate stochastic processes, specified as the
comma-separated pair consisting of `'MonteCarloMethod'`

and 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`

and `N`

), `simBySolution`

ignores the value of `MonteCarloMethod`

.

**Data Types: **`string`

| `char`

`QuasiSequence`

— Low discrepancy sequence to drive stochastic processes

`"sobol"`

(default) | string with value `"sobol"`

| character vector with value `'sobol'`

Low discrepancy sequence to drive the stochastic processes, specified
as the comma-separated pair consisting of
`'QuasiSequence'`

and 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

`MonteCarloMethod`

option is not specified or specified as`"standard"`

,`QuasiSequence`

is ignored.If you specify an input noise process (see

`Z`

),`simBySolution`

ignores the value of`QuasiSequence`

.

**Data Types: **`string`

| `char`

`BrownianMotionMethod`

— Brownian motion construction method

`"standard"`

(default) | string with value `"brownian-bridge"`

or
`"principal-components"`

| character vector with value `'brownian-bridge'`

or
`'principal-components'`

Brownian motion construction method, specified as the comma-separated
pair consisting of `'BrownianMotionMethod'`

and 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`

`Z`

— Direct specification of the dependent random noise process for generating Brownian motion vector

generates correlated Gaussian variates based on the
`Correlation`

member of the `SDE`

object (default) | function | three-dimensional array of dependent random variates

Direct specification of the dependent random noise process for
generating the Brownian motion vector (Wiener process) that drives the
simulation, specified as the comma-separated pair consisting of
`'Z'`

and a function or an ```
(NPeriods *
NSteps)
```

-by-`NBrowns`

-by-`NNTrials`

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 `merton`

object and the
value of the `Antithetic`

input flag.

Specifically, when `Z`

is specified,
`Correlation`

is not explicitly used to generate
the Gaussian variates that drive the Brownian motion. However,
`Correlation`

is still used in the expression that
appears in the exponential term of the
log[*X*_{t}]
Euler scheme. Thus, you must specify `Z`

as a
correlated Gaussian noise process whose correlation structure is
consistently captured by `Correlation`

.

**Note**

If you specify `Z`

as a function, it must return
an `NBrowns`

-by-`1`

column vector,
and you must call it with two inputs:

A real-valued scalar observation time

*t*An

`NVars`

-by-`1`

state vector*X*_{t}

**Data Types: **`double`

| `function`

`N`

— Dependent random counting process for generating number of jumps

random numbers from Poisson distribution with
`merton`

object parameter
`JumpFreq`

(default) | three-dimensional array | function

Dependent random counting process for generating the number of jumps,
specified as the comma-separated pair consisting of
`'N'`

and a function or an
(`NPeriods`

⨉ `NSteps`

)
-by-`NJumps`

-by-`NNTrials`

three-dimensional array of dependent random variates. If you specify a
function, `N`

must return an
`NJumps`

-by-`1`

column vector, and
you must call it with two inputs: a real-valued scalar observation time
*t* followed by an
`NVars`

-by-`1`

state vector
*X _{t}*.

**Data Types: **`double`

| `function`

`StorePaths`

— Flag that indicates how `Paths`

is stored and returned

`true`

(default) | logical with values `true`

or
`false`

Flag that indicates how the output array `Paths`

is
stored and returned, specified as the comma-separated pair consisting of
`'StorePaths'`

and a scalar numeric or logical
`1`

(`true`

) or
`0`

(`false`

).

If

`StorePaths`

is`true`

(the default value) or is unspecified,`simBySolution`

returns`Paths`

as a three-dimensional time series array.If

`StorePaths`

is`false`

(logical`0`

),`simBySolution`

returns`Paths`

as an empty matrix.

**Data Types: **`logical`

`Processes`

— Sequence of end-of-period processes or state vector adjustments of the form

`simBySolution`

makes no adjustments
and performs no processing (default) | function | cell array of functions

Sequence of end-of-period processes or state vector adjustments,
specified as the comma-separated pair consisting of
`'Processes'`

and a function or cell array of
functions of the form

$${X}_{t}=P(t,{X}_{t})$$

`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
*X*_{t}, and
return a state vector that can be an adjustment to the input
state.

The end-of-period `Processes`

argument allows you to
terminate a given trial early. At the end of each time step,
`simBySolution`

tests the state vector
*X _{t}*
for an all-

`NaN`

condition. Thus, to signal an early
termination of a given trial, all elements of the state vector
*X*must be

_{t}`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).If you specify more than one processing function,
`simBySolution`

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.

**Data Types: **`cell`

| `function`

## Output Arguments

`Paths`

— Simulated paths of correlated state variables

array

Simulated paths of correlated state variables, returned as an
```
(NPeriods +
1)
```

-by-`NVars`

-by-`NNTrials`

three-dimensional time-series array.

For a given trial, each row of `Paths`

is the transpose
of the state vector
*X*_{t} at time
*t*. When `StorePaths`

is set to
`false`

, `simBySolution`

returns
`Paths`

as an empty matrix.

`Times`

— Observation times associated with simulated paths

column vector

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`

.

`Z`

— Dependent random variates for generating Brownian motion vector

array

Dependent random variates for generating the Brownian motion vector
(Wiener processes) that drive the simulation, returned as a
```
(NPeriods *
NSteps)
```

-by-`NBrowns`

-by-`NNTrials`

three-dimensional time-series array.

`N`

— Dependent random variates for generating the jump counting process vector

array

Dependent random variates for generating the jump counting process vector,
returned as an ```
(NPeriods ⨉
NSteps)
```

-by-`NJumps`

-by-`NNTrials`

three-dimensional time-series array.

## More About

### 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 that has the same expected value but a 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 other
pairs, 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 NTrials.

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

The `simBySolution`

function simulates the state vector
*X _{t}* by an approximation of the
closed-form solution of diagonal drift Merton jump diffusion models. Specifically, it
applies a Euler approach to the transformed

`log`

[*X*] process (using Ito's formula). In general, this is not the exact solution to the Merton jump diffusion model because the probability distributions of the simulated and true state vectors are identical only for piecewise constant parameters.

_{t}This function simulates any vector-valued `merton`

process of the
form

$$d{X}_{t}=B(t,{X}_{t}){X}_{t}dt+D(t,{X}_{t})V(t,{x}_{t})d{W}_{t}+Y(t,{X}_{t},{N}_{t}){X}_{t}d{N}_{t}$$

Here:

*X*is an_{t}`NVars`

-by-`1`

state vector of process variables.*B*(*t*,*X*_{t}) is an`NVars`

-by-`NVars`

matrix of generalized expected instantaneous rates of return.

is an*D*(*t*,*X*_{t})`NVars`

-by-`NVars`

diagonal matrix in which each element along the main diagonal is the corresponding element of the state vector.

is an*V*(*t*,*X*_{t})`NVars`

-by-`NVars`

matrix of instantaneous volatility rates.*dW*_{t}is an`NBrowns`

-by-`1`

Brownian motion vector.

is an*Y*(*t*,*X*_{t},*N*_{t})`NVars`

-by-`NJumps`

matrix-valued jump size function.*dN*_{t}is an`NJumps`

-by-`1`

counting process vector.

## References

[1] Aït-Sahalia, Yacine. “Testing
Continuous-Time Models of the Spot Interest Rate.” *Review of Financial
Studies*, Vol. 9, No. 2 ( Apr. 1996): 385–426.

[2] Aït-Sahalia, Yacine.
“Transition Densities for Interest Rate and Other Nonlinear Diffusions.” *The
Journal of Finance*, Vol. 54, No. 4 (Aug. 1999): 1361–95.

[3] Glasserman, Paul.
*Monte Carlo Methods in Financial Engineering*, New York:
Springer-Verlag, 2004.

[4] Hull, John C.
*Options, Futures and Other Derivatives*, 7th ed, Prentice
Hall, 2009.

[5] Johnson, Norman Lloyd, Samuel
Kotz, and Narayanaswamy Balakrishnan. *Continuous Univariate
Distributions*, 2nd ed. Wiley Series in Probability and Mathematical
Statistics. New York: Wiley, 1995.

[6] Shreve, Steven E.
*Stochastic Calculus for Finance*, New York: Springer-Verlag,
2004.

## Version History

**Introduced in R2020a**

### R2022b: Perform Brownian bridge and principal components construction

Perform Brownian bridge and principal components construction using the name-value
argument `BrownianMotionMethod`

.

### R2022a: Perform Quasi-Monte Carlo simulation

Perform Quasi-Monte Carlo simulation using the name-value arguments
`MonteCarloMethod`

and
`QuasiSequence`

.

## See Also

### Topics

- Simulating Equity Prices
- Simulating Interest Rates
- Stratified Sampling
- Price American Basket Options Using Standard Monte Carlo and Quasi-Monte Carlo Simulation
- Base SDE Models
- Drift and Diffusion Models
- Linear Drift Models
- Parametric Models
- SDEs
- SDE Models
- SDE Class Hierarchy
- Quasi-Monte Carlo Simulation
- Performance Considerations

## Open Example

You have a modified version of this example. Do you want to open this example with your edits?

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)