naginterfaces.library.rand.copula_students_t¶
- naginterfaces.library.rand.copula_students_t(mode, n, df, c, comm, statecomm)[source]¶
copula_students_t
sets up a reference vector and generates an array of pseudorandom numbers from a Student’s copula with degrees of freedom and covariance matrix .For full information please refer to the NAG Library document for g05rc
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/g05/g05rcf.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_students_t
.Set up reference vector and generate variates.
- nint
, the number of random variates required.
- dfint
, the number of degrees of freedom of the distribution.
- cfloat, array-like, shape
Matrix which, along with , defines the covariance 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_students_t
.- statecommdict, RNG communication object, modified in place
RNG communication structure.
This argument must have been initialized by a prior call to
init_repeat()
orinit_nonrepeat()
.
- Returns
- xNone or float, ndarray, shape
The array of values from a multivariate Student’s 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, .
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 Student’s copula, , is defined by
where is the number of dimensions, is the multivariate Student’s density function with degrees of freedom, mean zero and covariance matrix and is the inverse of the univariate Student’s density function with degrees of freedom, zero mean and variance .
multivar_students_t()
is used to generate a vector from a multivariate Student’s distribution andstat.prob_students_t
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) orinit_nonrepeat()
(for a non-repeatable sequence) must be called prior to the first call tocopula_students_t
.
- 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