naginterfaces.library.rand.bb_​inc

naginterfaces.library.rand.bb_inc(npaths, diff, z, c, comm, rcord=2, a=1)[source]

bb_inc computes scaled increments of sample paths of a free or non-free Wiener process, where the sample paths are constructed by a Brownian bridge algorithm. The initialization function bb_inc_init() must be called prior to the first call to bb_inc.

For full information please refer to the NAG Library document for g05xd

https://www.nag.com/numeric/nl/nagdoc_27.1/flhtml/g05/g05xdf.html

Parameters
npathsint

The number of Wiener sample paths.

difffloat, array-like, shape

The difference between the terminal value and starting value of the Wiener process. If , is ignored.

zfloat, array-like, shape

Note: the required extent for this argument in dimension 1 is determined as follows: if : ; if : ; otherwise: .

Note: the required extent for this argument in dimension 2 is determined as follows: if : ; if : ; otherwise: .

The Normal random numbers used to construct the sample paths.

If quasi-random numbers are used, the -dimensional quasi-random points should be stored in successive rows of .

cfloat, array-like, shape

The lower triangular Cholesky factorization such that gives the covariance matrix of the Wiener process. Elements of above the diagonal are not referenced.

commdict, communication object

Communication structure.

This argument must have been initialized by a prior call to bb_inc_init().

rcordint, optional

The order in which Normal random numbers are stored in and in which the generated values are returned in .

aint, optional

If , a free Wiener process is created and is ignored.

If , a non-free Wiener process is created where is the difference between the terminal value and the starting value of the process.

Returns
zfloat, ndarray, shape

The Normal random numbers premultiplied by .

bfloat, ndarray, shape

The scaled Wiener increments.

Let denote the th dimension of the th point of the th sample path where , and .

The increment is stored at .

Raises
NagValueError
(errno )

An unexpected error occurred during execution of bb_inc. Please contact NAG with the following error message: error in , .

(errno )

On entry, [‘rcomm’] was not initialized or has been corrupted.

(errno )

On entry, .

Constraint: .

(errno )

On entry, the value of is invalid.

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, and .

Constraint: .

Notes

For details on the Brownian bridge algorithm and the bridge construction order see the G05 Introduction and Notes for bb_inc_init. Recall that the terms Wiener process (or free Wiener process) and Brownian motion are often used interchangeably, while a non-free Wiener process (also known as a Brownian bridge process) refers to a process which is forced to terminate at a given point.

Fix two times , let be any set of time points satisfying , and let , , denote a -dimensional Wiener sample path at these time points.

The Brownian bridge increments generator uses the Brownian bridge algorithm to construct sample paths for the (free or non-free) Wiener process , and then uses this to compute the scaled Wiener increments

References

Glasserman, P, 2004, Monte Carlo Methods in Financial Engineering, Springer