nag_rngs_copula_students_t (g05rbc) sets up a reference vector and generates an array of pseudorandom numbers from a Student's copula with degrees of freedom and covariance matrix .
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
.
Routine
nag_rngs_matrix_multi_students_t (g05lxc) is used to generate a vector from a multivariate Student's
distribution and function
nag_prob_students_t (g01ebc) is used to convert each element of that vector into a uniformly distributed value between zero and one.
One of the initialization functions
nag_rngs_init_repeatable (g05kbc) (for a repeatable sequence if computed sequentially) or
nag_rngs_init_nonrepeatable (g05kcc) (for a non-repeatable sequence) must be called prior to the first call to nag_rngs_copula_students_t (g05rbc).
- 1:
order – Nag_OrderTypeInput
-
On entry: the
order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by
. See
Section 3.2.1.3 in the Essential Introduction for a more detailed explanation of the use of this argument.
Constraint:
or Nag_ColMajor.
- 2:
mode – IntegerInput
On entry: selects the operation to be performed.
- Initialize and generate random numbers.
- Initialize only (i.e., set up reference vector).
- Generate random numbers using previously set up reference vector.
Constraint:
, or .
- 3:
df – IntegerInput
On entry: , the number of degrees of freedom of the distribution.
Constraint:
.
- 4:
m – IntegerInput
On entry:
, the number of dimensions of the distribution.
Constraint:
.
- 5:
c[] – const doubleInput
-
Note: the dimension,
dim, of the array
c
must be at least
.
The
th element of the matrix
is stored in
- when ;
- when .
On entry: matrix which, along with
df, defines the covariance of the distribution. Only the upper triangle need be set.
- 6:
pdc – IntegerInput
-
On entry: the stride separating row or column elements (depending on the value of
order) in the array
c.
Constraint:
.
- 7:
n – IntegerInput
On entry:
, the number of random variates required.
Constraint:
.
- 8:
x[] – doubleOutput
-
Note: the dimension,
dim, of the array
x
must be at least
- when ;
- when .
The
th element of the
th vector
is stored in
- when ;
- when .
On exit: the array of pseudorandom multivariate Student's vectors.
- 9:
pdx – IntegerInput
-
On entry: the stride used in the array
x.
Constraints:
- if ,
;
- if , .
- 10:
igen – IntegerInput
On entry: must contain the identification number for the generator to be used to return a pseudorandom number and should remain unchanged following initialization by a prior call to
nag_rngs_init_repeatable (g05kbc) or
nag_rngs_init_nonrepeatable (g05kcc).
- 11:
iseed[] – IntegerCommunication Array
On entry: contains values which define the current state of the selected generator.
On exit: contains updated values defining the new state of the selected generator.
- 12:
r[lr] – doubleCommunication Array
On entry: if , the reference vector as set up by nag_rngs_copula_students_t (g05rbc) in a previous call with or .
On exit: if or , the reference vector that can be used in subsequent calls to nag_rngs_copula_students_t (g05rbc) with .
- 13:
lr – IntegerInput
On entry: the dimension of the array
r. If
, it must be the same as the value of
lr specified in the prior call to nag_rngs_copula_students_t (g05rbc) with
or
.
Constraint:
.
- 14:
fail – NagError *Input/Output
-
The NAG error argument (see
Section 3.6 in the Essential Introduction).
- NE_ALLOC_FAIL
Dynamic memory allocation failed.
- NE_BAD_PARAM
On entry, argument had an illegal value.
- NE_INT
On entry, .
Constraint: .
On entry, invalid value for
igen. Ensure
igen has not changed since random number generator was initialized.
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: and .
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: .
- NE_INT_2
m is not the same as when
r was set up in a previous call. Previous value
and
.
On entry, , .
Constraint: .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
- NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact
NAG for assistance.
- NE_POS_DEF
The covariance matrix
c is not positive semidefinite to
machine precision.
See
Section 7 in nag_rngs_matrix_multi_students_t (g05lxc) for an indication of the accuracy of the underlying multivariate
-distribution.
None.
This example prints ten pseudorandom observations from a Student's
copula with ten degrees of freedom and
c matrix
generated by nag_rngs_copula_students_t (g05rbc). All ten observations are generated by a single call to nag_rngs_copula_students_t (g05rbc) with
. The random number generator is initialized by
nag_rngs_init_repeatable (g05kbc).
None.