hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_rand_copula_frank_bivar (g05rf)


    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example


nag_rand_copula_frank_bivar (g05rf) generates pseudorandom uniform bivariates with joint distribution of a Frank Archimedean copula.


[state, x, ifail] = g05rf(n, theta, sorder, state)
[state, x, ifail] = nag_rand_copula_frank_bivar(n, theta, sorder, state)


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 functions nag_rand_init_repeat (g05kf) (for a repeatable sequence if computed sequentially) or nag_rand_init_nonrepeat (g05kg) (for a non-repeatable sequence) must be called prior to the first call to nag_rand_copula_frank_bivar (g05rf).


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


Compulsory Input Parameters

1:     n int64int32nag_int scalar
n, the number of bivariates to generate.
Constraint: n0.
2:     theta – double scalar
θ, the copula parameter.
3:     sorder int64int32nag_int scalar
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: int64int32nag_int array
Note: the actual argument supplied must be the array state supplied to the initialization routines nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).
Contains information on the selected base generator and its current state.

Optional Input Parameters


Output Parameters

1:     state: int64int32nag_int array
Contains updated information on the state of the generator.
2:     xldxsdx – double array
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.
3:     ifail int64int32nag_int scalar
ifail=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Errors or warnings detected by the function:
On entry, corrupt state argument.
Constraint: n0.
On entry, invalid sorder.
Constraint: sorder=1 or 2.
On entry, ldx is too small: ldx=_.
On entry, sdx is too small: sdx=_.
An unexpected error has been triggered by this routine. Please contact NAG.
Your licence key may have expired or may not have been installed correctly.
Dynamic memory allocation failed.


Not applicable.

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_machine_real_safe (x02am); and ε is the machine precision returned by nag_machine_precision (x02aj).


This example generates thirteen variates for copula C-12.0.
function g05rf_example

fprintf('g05rf example results\n\n');

% Initialize the base generator to a repeatable sequence
seed  = [int64(1762543)];
genid = int64(1);
subid = int64(1);
[state, ifail] = g05kf( ...
                        genid, subid, seed);

% Sample size and order
n      = int64(13);
sorder = int64(1);

% Parameter
theta = -12;

% Generate variates
[state, x, ifail] = g05rf( ...
                           n, theta, sorder, state);

disp('Variates from a bivariate Frank copula');

g05rf example results

Variates from a bivariate Frank copula
    0.6364    0.1411
    0.1065    0.8967
    0.7460    0.1843
    0.7983    0.1254
    0.1046    0.9982
    0.4925    0.6901
    0.3843    0.6250
    0.7871    0.1654
    0.4982    0.5298
    0.6717    0.2902
    0.0505    0.9554
    0.2580    0.8190
    0.6238    0.3014

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

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