G05RHF (PDF version)
G05 Chapter Contents
G05 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

G05RHF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

G05RHF generates pseudorandom uniform variates with joint distribution of a Clayton/Cook–Johnson Archimedean copula.

2  Specification

SUBROUTINE G05RHF ( N, M, THETA, SORDER, STATE, X, LDX, SDX, IFAIL)
INTEGER  N, M, SORDER, STATE(*), LDX, SDX, IFAIL
REAL (KIND=nag_wp)  THETA, X(LDX,SDX)

3  Description

Generates n pseudorandom uniform m-variates whose joint distribution is the Clayton/Cook–Johnson Archimedean copula Cθ, given by
Cθ = u1-θ + u2-θ + + um-θ - m + 1 -1/θ ,   θ 0, , uj 0,1 ,   j = 1 , m ;
with the special case:
The generation method uses mixture of powers.
One of the initialization routines G05KFF (for a repeatable sequence if computed sequentially) or G05KGF (for a non-repeatable sequence) must be called prior to the first call to G05RHF.

4  References

Marshall A W and Olkin I (1988) Families of multivariate distributions Journal of the American Statistical Association 83 403
Nelsen R B (2006) An Introduction to Copulas (2nd Edition) Springer Series in Statistics

5  Parameters

1:     N – INTEGERInput
On entry: n, the number of pseudorandom uniform variates to generate.
Constraint: N0.
2:     M – INTEGERInput
On entry: m, the number of dimensions.
Constraint: M2.
3:     THETA – REAL (KIND=nag_wp)Input
On entry: θ, the copula parameter.
Constraint: THETA1.0×10-6.
4:     SORDER – INTEGERInput
On entry: determines the storage order of variates; the i,jth variate is stored in Xij if SORDER=1, and Xji if SORDER=2, for i=1,2,,n and j=1,2,,m.
Constraint: SORDER=1 or 2.
5:     STATE(*) – INTEGER arrayCommunication Array
Note: the actual argument supplied must be the array STATE supplied to the initialization routines G05KFF or G05KGF.
On entry: contains information on the selected base generator and its current state.
On exit: contains updated information on the state of the generator.
6:     X(LDX,SDX) – REAL (KIND=nag_wp) arrayOutput
On exit: the pseudorandom uniform variates with joint distribution described by Cθ, with Xij holding the ith value for the jth dimension if SORDER=1 and the jth value for the ith dimension of SORDER=2.
7:     LDX – INTEGERInput
On entry: the first dimension of the array X as declared in the (sub)program from which G05RHF is called.
Constraints:
  • if SORDER=1, LDXN;
  • if SORDER=2, LDXM.
8:     SDX – INTEGERInput
On entry: the second dimension of the array X as declared in the (sub)program from which G05RHF is called.
Constraints:
  • if SORDER=1, SDXM;
  • if SORDER=2, SDXN.
9:     IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
IFAIL=1
On entry,STATE vector was not initialized or has been corrupted.
IFAIL=2
On entry,THETA<1.0×10-6.
IFAIL=3
On entry,N<0.
IFAIL=4
On entry,M<2.
IFAIL=5
On entry,SORDER1 and SORDER2.
IFAIL=7
On entry,SORDER=1 and LDX<N,
orSORDER=2 and LDX<M.
IFAIL=8
On entry,SORDER=1 and SDX<M,
orSORDER=2 and SDX<N.

7  Accuracy

Not applicable.

8  Further Comments

In practice, the need for numerical stability restricts the range of θ such that:

9  Example

This example generates thirteen four-dimensional variates for copula C1.3.

9.1  Program Text

Program Text (g05rhfe.f90)

9.2  Program Data

Program Data (g05rhfe.d)

9.3  Program Results

Program Results (g05rhfe.r)


G05RHF (PDF version)
G05 Chapter Contents
G05 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012