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

NAG Library Routine Document


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

G05RGF generates pseudorandom uniform bivariates with joint distribution of a Plackett copula.

2  Specification


3  Description

Generates pseudorandom uniform bivariates u1,u20,12 whose joint distribution is the Plackett copula Cθ with parameter θ, given by
Cθ = 1 + θ-1 u1 + u2 - 1 + θ-1 u1 + u2 2 - 4 u1 u2 θ θ-1 2θ-1 ,   θ 0, 1
with the special cases:
The generation method uses conditional sampling.
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 G05RGF.

4  References

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 bivariates to generate.
Constraint: N0.
2:     THETA – REAL (KIND=nag_wp)Input
On entry: θ, the copula parameter.
Constraint: THETA0.0.
3:     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.
Constraint: SORDER=1 or 2.
4:     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.
5:     X(LDX,SDX) – REAL (KIND=nag_wp) arrayOutput
On exit: the n bivariate uniforms 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.
6:     LDX – INTEGERInput
On entry: the first dimension of the array X as declared in the (sub)program from which G05RGF is called.
  • if SORDER=1, LDXN;
  • if SORDER=2, LDX2.
7:     SDX – INTEGERInput
On entry: the second dimension of the array X as declared in the (sub)program from which G05RGF is called.
  • if SORDER=1, SDX2;
  • if SORDER=2, SDXN.
8:     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:
On entry,STATE vector was not initialized or has been corrupted.
On entry,THETA<0.0
On entry,N<0.
On entry,SORDER1 and SORDER2.
On entry,SORDER=1 and LDX<N,
orSORDER=2 and LDX<2.
On entry,SORDER=1 and SDX<2,
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: where εs is the safe-range parameter, the value of which is returned by X02AMF; and ε is the machine precision returned by X02AJF.

9  Example

This example generates thirteen variates for copula C2.0.

9.1  Program Text

Program Text (g05rgfe.f90)

9.2  Program Data

Program Data (g05rgfe.d)

9.3  Program Results

Program Results (g05rgfe.r)

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

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