NAG CL Interface
g05rgc (copula_​plackett_​bivar)

Settings help

CL Name Style:


1 Purpose

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

2 Specification

#include <nag.h>
void  g05rgc (Nag_OrderType order, Integer state[], double theta, Integer n, double x[], Integer pdx, Integer sdx, NagError *fail)
The function may be called by the names: g05rgc, nag_rand_copula_plackett_bivar or nag_rand_bivariate_copula_plackett.

3 Description

Generates pseudorandom uniform bivariates {u1,u2}[0,1]2 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 functions g05kfc (for a repeatable sequence if computed sequentially) or g05kgc (for a non-repeatable sequence) must be called prior to the first call to g05rgc.

4 References

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

5 Arguments

1: order Nag_OrderType Input
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 3.1.3 in the Introduction to the NAG Library CL Interface for a more detailed explanation of the use of this argument.
Constraint: order=Nag_RowMajor or Nag_ColMajor.
2: state[dim] Integer Communication 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 double Input
On entry: θ, the copula parameter.
Constraint: theta0.0.
4: n Integer Input
On entry: n, the number of bivariates to generate.
Constraint: n0.
5: x[pdx×sdx] double Output
Note: where X(i,j) appears in this document, it refers to the array element
  • x[(j-1)×pdx+i-1] when order=Nag_ColMajor;
  • x[(i-1)×pdx+j-1] when order=Nag_RowMajor.
On exit: the n bivariate uniforms with joint distribution described by Cθ, with X(i,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 Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array x.
Constraints:
  • if order=Nag_ColMajor, pdxn;
  • if order=Nag_RowMajor, pdx2.
7: sdx Integer Input
On entry: the secondary dimension of X.
Constraints:
  • if order=Nag_ColMajor, sdx2;
  • if order=Nag_RowMajor, sdxn.
8: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_INT
On entry, n=value.
Constraint: n0.
NE_INT_2
On entry, pdx must be at least value: pdx=value.
On entry, sdx must be at least value: sdx=value.
NE_INTERNAL_ERROR
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 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_INVALID_STATE
On entry, corrupt state argument.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
NE_REAL
On entry, invalid theta: theta=value.
Constraint: theta0.0.

7 Accuracy

Not applicable.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
g05rgc 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.

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

10 Example

This example generates thirteen variates for copula C2.0.

10.1 Program Text

Program Text (g05rgce.c)

10.2 Program Data

None.

10.3 Program Results

Program Results (g05rgce.r)