NAG C Library Function Document

nag_rand_bivariate_copula_clayton (g05rec)


nag_rand_bivariate_copula_clayton (g05rec) generates pseudorandom uniform bivariates with joint distribution of a Clayton/Cook–Johnson Archimedean copula.


#include <nag.h>
#include <nagg05.h>
void  nag_rand_bivariate_copula_clayton (Nag_OrderType order, Integer state[], double theta, Integer n, double x[], Integer pdx, Integer sdx, NagError *fail)


Generates pseudorandom uniform bivariates u1,u20,12 whose joint distribution is the Clayton/Cook–Johnson Archimedean copula Cθ with parameter θ, given by
Cθ = max u1 -θ + u2 -θ -1 ,0 -1/θ ,   θ -1, 0  
with the special cases:
The generation method uses conditional sampling.
One of the initialization functions nag_rand_init_repeatable (g05kfc) (for a repeatable sequence if computed sequentially) or nag_rand_init_nonrepeatable (g05kgc) (for a non-repeatable sequence) must be called prior to the first call to nag_rand_bivariate_copula_clayton (g05rec).


Nelsen R B (2006) An Introduction to Copulas (2nd Edition) Springer Series in Statistics


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 order=Nag_RowMajor. See Section in How to Use the NAG Library and its Documentation for a more detailed explanation of the use of this argument.
Constraint: order=Nag_RowMajor or Nag_ColMajor.
2:     state[dim] IntegerCommunication Array
Note: the dimension, dim, of this array is dictated by the requirements of associated functions that must have been previously called. This array MUST be the same array passed as argument state in the previous call to nag_rand_init_repeatable (g05kfc) or nag_rand_init_nonrepeatable (g05kgc).
On entry: contains information on the selected base generator and its current state.
On exit: contains updated information on the state of the generator.
3:     theta doubleInput
On entry: θ, the copula parameter.
Constraint: theta-1.0.
4:     n IntegerInput
On entry: n, the number of bivariates to generate.
Constraint: n0.
5:     x[pdx×sdx] doubleOutput
Note: where Xi,j appears in this document, it refers to the array element x[j-1×pdx+i-1].
On exit: the n bivariate uniforms with joint distribution described by Cθ, with Xi,j holding the ith value for the jth dimension if order=Nag_ColMajor and the jth value for the ith dimension if order=Nag_RowMajor.
6:     pdx IntegerInput
On entry: the stride separating matrix row elements in the array x.
  • if order=Nag_ColMajor, pdxn;
  • if order=Nag_RowMajor, pdx2.
7:     sdx IntegerInput
On entry: the secondary dimension of X.
  • if order=Nag_ColMajor, sdx2;
  • if order=Nag_RowMajor, sdxn.
8:     fail NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

Error Indicators and Warnings

Dynamic memory allocation failed.
See Section in How to Use the NAG Library and its Documentation for further information.
On entry, argument value had an illegal value.
On entry, n=value.
Constraint: n0.
On entry, pdx must be at least value: pdx=value.
On entry, sdx must be at least value: sdx=value.
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.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
On entry, corrupt state argument.
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
On entry, invalid theta: theta=value.
Constraint: theta-1.0.


Not applicable.

Parallelism and Performance

nag_rand_bivariate_copula_clayton (g05rec) 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 function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

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 nag_real_safe_small_number (X02AMC); and ε is the machine precision returned by nag_machine_precision (X02AJC).


This example generates thirteen variates for copula C-0.8.

Program Text

Program Text (g05rece.c)

Program Data


Program Results

Program Results (g05rece.r)