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

NAG Library Routine Document

G05RFF

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

G05RFF generates pseudorandom uniform bivariates with joint distribution of a Frank Archimedean copula.

2  Specification

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

3  Description

Generates pseudorandom uniform bivariates u1,u20,12 whose joint distribution is the Frank Archimedean copula Cθ with parameter θ, given by
Cθ = - 1θ ln 1 + e -θu1 -1 e -θu2 -1 e-θ-1 ,   θ -, 0  
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 G05RFF.

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.
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:     XLDXSDX – 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 if SORDER=2.
6:     LDX – INTEGERInput
On entry: the first dimension of the array X as declared in the (sub)program from which G05RFF is called.
Constraints:
  • 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 G05RFF is called.
Constraints:
  • 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:
IFAIL=1
On entry, corrupt STATE parameter.
IFAIL=3
On entry, N=value.
Constraint: N0.
IFAIL=4
On entry, invalid SORDER.
Constraint: SORDER=1 or 2.
IFAIL=6
On entry, LDX must be at least value: LDX=value.
IFAIL=7
On entry, SDX must be at least value: SDX=value.
IFAIL=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.8 in the Essential Introduction for further information.
IFAIL=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.7 in the Essential Introduction for further information.
IFAIL=-999
Dynamic memory allocation failed.
See Section 3.6 in the Essential Introduction for further information.

7  Accuracy

Not applicable.

8  Parallelism and Performance

G05RFF is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9  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.

10  Example

This example generates thirteen variates for copula C-12.0.

10.1  Program Text

Program Text (g05rffe.f90)

10.2  Program Data

Program Data (g05rffe.d)

10.3  Program Results

Program Results (g05rffe.r)


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

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