naginterfaces.library.rand.multivar_students_t¶
- naginterfaces.library.rand.multivar_students_t(mode, n, df, xmu, c, comm, statecomm)[source]¶
multivar_students_t
sets up a reference vector and generates an array of pseudorandom numbers from a multivariate Student’s distribution with degrees of freedom, mean vector and covariance matrix .For full information please refer to the NAG Library document for g05ry
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/g05/g05ryf.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
multivar_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.
- xmufloat, array-like, shape
, the vector of means 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
multivar_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 pseudorandom multivariate Student’s vectors generated by the function, 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
When the covariance matrix is nonsingular (i.e., strictly positive definite), the distribution has probability density function
where is the number of dimensions, is the degrees of freedom, is the vector of means, is the vector of positions and is the covariance matrix.
The function returns the value
where is generated by
dist_normal()
from a Normal distribution with mean zero and covariance matrix and is generated bydist_chisq()
from a -distribution with degrees of freedom.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 tomultivar_students_t
.
- References
Knuth, D E, 1981, The Art of Computer Programming (Volume 2), (2nd Edition), Addison–Wesley
Wilkinson, J H, 1965, The Algebraic Eigenvalue Problem, Oxford University Press, Oxford