g05rc sets up a reference vector and generates an array of pseudorandom numbers from a Student's t copula with ν degrees of freedom and covariance matrix νν-2C.


public static void g05rc(
	int mode,
	int n,
	int df,
	int m,
	double[,] c,
	double[] r,
	G05..::..G05State g05state,
	double[,] x,
	out int ifail
Visual Basic
Public Shared Sub g05rc ( _
	mode As Integer, _
	n As Integer, _
	df As Integer, _
	m As Integer, _
	c As Double(,), _
	r As Double(), _
	g05state As G05..::..G05State, _
	x As Double(,), _
	<OutAttribute> ByRef ifail As Integer _
Visual C++
static void g05rc(
	int mode, 
	int n, 
	int df, 
	int m, 
	array<double,2>^ c, 
	array<double>^ r, 
	G05..::..G05State^ g05state, 
	array<double,2>^ x, 
	[OutAttribute] int% ifail
static member g05rc : 
        mode : int * 
        n : int * 
        df : int * 
        m : int * 
        c : float[,] * 
        r : float[] * 
        g05state : G05..::..G05State * 
        x : float[,] * 
        ifail : int byref -> unit 


Type: System..::..Int32
On entry: a code for selecting the operation to be performed by the method.
Set up reference vector only.
Generate variates using reference vector set up in a prior call to g05rc.
Set up reference vector and generate variates.
Constraint: mode=0, 1 or 2.
Type: System..::..Int32
On entry: n, the number of random variates required.
Constraint: n0.
Type: System..::..Int32
On entry: ν, the number of degrees of freedom of the distribution.
Constraint: df3.
Type: System..::..Int32
On entry: m, the number of dimensions of the distribution.
Constraint: m>0.
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, m]
Note: dim1 must satisfy the constraint: dim1m
On entry: matrix which, along with df, defines the covariance of the distribution. Only the upper triangle need be set.
Constraint: C must be positive semidefinite to machine precision.
Type: array<System..::..Double>[]()[][]
An array of size [lr]
On entry: if mode=1, the reference vector as set up by g05rc in a previous call with mode=0 or 2.
On exit: if mode=0 or 2, the reference vector that can be used in subsequent calls to g05rc with mode=1.
Type: NagLibrary..::..G05..::..G05State
An Object of type G05.G05State.
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, _tdx]
Note: dim1 must satisfy the constraint: dim1n
On exit: the array of values from a multivariate Student's t copula, with x[i-1,j-1] holding the jth dimension for the ith variate.
Type: System..::..Int32%
On exit: ifail=0 unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).


The Student's t copula, G, is defined by
where m is the number of dimensions, Tν,Cm is the multivariate Student's t density function with ν degrees of freedom, mean zero and covariance matrix νν-2C and tν,Cii-1 is the inverse of the univariate Student's t density function with ν degrees of freedom, zero mean and variance νν-2Cii.
g05ry is used to generate a vector from a multivariate Student's t distribution and g01eb is used to convert each element of that vector into a uniformly distributed value between zero and one.
One of the initialization methods (G05KFF not in this release) (for a repeatable sequence if computed sequentially) or (G05KGF not in this release) (for a non-repeatable sequence) must be called prior to the first call to g05rc.


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

Error Indicators and Warnings

Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface (LDC, LDX) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
On entry, mode0, 1 or 2.
On entry, n<0.
On entry, df2.
On entry, m<1.
The covariance matrix C is not positive semidefinite to machine precision.
On entry, ldc<m.
The reference vector r has been corrupted or m has changed since r was set up in a previous call to g05rc with mode=0 or 2.
On entry, lrm×m+1+1.
On entry,state vector was not initialized or has been corrupted.
On entry, ldx<n.
An error occured, see message report.
Invalid Parameters value
Invalid dimension for array value
Negative dimension for array value
Invalid Parameters value


See [Accuracy] in g05ry for an indication of the accuracy of the underlying multivariate Student's t-distribution.

Parallelism and Performance


Further Comments

The time taken by g05rc is of order nm3.
It is recommended that the diagonal elements of C should not differ too widely in order of magnitude. This may be achieved by scaling the variables if necessary. The actual matrix decomposed is C+E=LLT, where E is a diagonal matrix with small positive diagonal elements. This ensures that, even when C is singular, or nearly singular, the Cholesky factor L corresponds to a positive definite covariance matrix that agrees with C within machine precision.


See Also