# naginterfaces.library.rand.copula_​normal¶

naginterfaces.library.rand.copula_normal(mode, n, c, comm, statecomm)[source]

copula_normal sets up a reference vector and generates an array of pseudorandom numbers from a Normal (Gaussian) copula with covariance matrix .

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

https://www.nag.com/numeric/nl/nagdoc_28.5/flhtml/g05/g05rdf.html

Parameters
modeint

A code for selecting the operation to be performed by the function.

Set up reference vector only.

Generate variates using reference vector set up in a prior call to copula_normal.

Set up reference vector and generate variates.

nint

, the number of random variates required.

cfloat, array-like, shape

The covariance matrix of the distribution. Only the upper triangle need be set.

commdict, communication object, modified in place

Communication structure for the reference vector.

If , this argument must have been initialized by a prior call to copula_normal.

statecommdict, RNG communication object, modified in place

RNG communication structure.

This argument must have been initialized by a prior call to init_repeat() or init_nonrepeat().

Returns
xNone or float, ndarray, shape

The array of values from a multivariate Gaussian copula, with holding the th dimension for the th variate.

Raises
NagValueError
(errno )

On entry, .

Constraint: , or .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, the covariance matrix is not positive semidefinite to machine precision.

(errno )

is not the same as when [‘r’] was set up in a previous call.

Previous value of and .

(errno )

On entry, [‘state’] vector has been corrupted or not initialized.

Notes

The Gaussian copula, , is defined by

where is the number of dimensions, is the multivariate Normal density function with mean zero and covariance matrix and is the inverse of the univariate Normal density function with mean zero and variance .

multivar_normal() is used to generate a vector from a multivariate Normal distribution and stat.prob_normal is used to convert each element of that vector into a uniformly distributed value between zero and one.

One of the initialization functions init_repeat() (for a repeatable sequence if computed sequentially) or init_nonrepeat() (for a non-repeatable sequence) must be called prior to the first call to copula_normal.

References

Nelsen, R B, 1998, An Introduction to Copulas. Lecture Notes in Statistics 139, Springer

Sklar, A, 1973, Random variables: joint distribution functions and copulas, Kybernetika (9), 499–460