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_gumbel (g05rk)

Purpose

nag_rand_copula_gumbel (g05rk) generates pseudorandom uniform variates with joint distribution of a Gumbel–Hougaard Archimedean copula.

Syntax

[state, x, ifail] = g05rk(n, m, theta, sorder, state)
[state, x, ifail] = nag_rand_copula_gumbel(n, m, theta, sorder, state)

Description

Generates nn pseudorandom uniform mm-variates whose joint distribution is the Gumbel–Hougaard Archimedean copula CθCθ, given by
Cθ = exp{ − [( − lnu1)θ + ( − lnu2)θ + ⋯ + ( − lnum)θ]} ,  
{ θ ∈ (1,∞) , uj ∈ (0,1] ,   j = 1 , 2 , … m ;
Cθ = exp{ - [ (-lnu1) θ + (-lnu2) θ + + (-lnum) θ ] } ,   { θ (1,) , uj (0,1] ,   j = 1 , 2 , m ;
with the special cases:
The generation method uses mixture of powers.
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_gumbel (g05rk).

References

Marshall A W and Olkin I (1988) Families of multivariate distributions Journal of the American Statistical Association 83 403
Nelsen R B (2006) An Introduction to Copulas (2nd Edition) Springer Series in Statistics

Parameters

Compulsory Input Parameters

1:     n – int64int32nag_int scalar
nn, the number of pseudorandom uniform variates to generate.
Constraint: n0n0.
2:     m – int64int32nag_int scalar
mm, the number of dimensions.
Constraint: m2m2.
3:     theta – double scalar
θθ, the copula parameter.
Constraint: theta1.0theta1.0.
4:     sorder – int64int32nag_int scalar
Determines the storage order of variates; the (i,j)(i,j)th variate is stored in x(i,j)xij if sorder = 1sorder=1, and x(j,i)xji if sorder = 2sorder=2, for i = 1,2,,ni=1,2,,n and j = 1,2,,mj=1,2,,m.
Constraint: sorder = 1sorder=1 or 22.
5:     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

None.

Input Parameters Omitted from the MATLAB Interface

ldx sdx

Output Parameters

1:     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 updated information on the state of the generator.
2:     x(ldx,sdx) – double array
The pseudorandom uniform variates with joint distribution described by CθCθ, with x(i,j)xij holding the iith value for the jjth dimension if sorder = 1sorder=1 and the jjth value for the iith dimension of sorder = 2sorder=2.
3:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:
  ifail = 1ifail=1
On entry, corrupt state parameter.
  ifail = 2ifail=2
Constraint: theta1.0theta1.0.
  ifail = 3ifail=3
Constraint: n0n0.
  ifail = 4ifail=4
Constraint: m > 1m>1.
  ifail = 5ifail=5
Invalid storage option.
  ifail = 7ifail=7
On entry, ldx is too small: .
  ifail = 8ifail=8
On entry, sdx is too small: .
  ifail = 999ifail=-999
Dynamic memory allocation failed.

Accuracy

Not applicable.

Further Comments

In practice, the need for numerical stability restricts the range of θθ such that: where εsεs is the safe-range parameter, the value of which is returned by nag_machine_real_safe (x02am).

Example

function nag_rand_copula_gumbel_example
% Initialize the seed
seed = [int64(1762543)];
% genid and subid identify the base generator
genid = int64(1);
subid =  int64(1);
% Sample size
n = int64(13);
m = int64(4);
% Sample order
sorder = int64(1);
% Parameter
theta = 2.4;

% Initialize the generator to a repeatable sequence
[state, ifail] = nag_rand_init_repeat(genid, subid, seed);

% Generate variates
[state, x, ifail] = nag_rand_copula_gumbel(n, m, theta, sorder, state)
 

state =

                   17
                 1234
                    1
                    0
                19862
                26460
                32347
                15920
                17917
                13895
                19930
                    8
                    0
                 1234
                    1
                    1
                 1234


x =

    0.9369    0.8676    0.9713    0.8854
    0.1139    0.3063    0.8625    0.2743
    0.4418    0.2211    0.5042    0.4985
    0.7902    0.6007    0.7493    0.6474
    0.8362    0.9847    0.8807    0.9079
    0.1781    0.4610    0.1283    0.1329
    0.1272    0.1760    0.1805    0.0383
    0.4473    0.2171    0.1662    0.1300
    0.8899    0.9005    0.8844    0.8879
    0.9069    0.8681    0.8450    0.8804
    0.2222    0.5499    0.4965    0.6488
    0.3807    0.5967    0.5096    0.3577
    0.8445    0.7755    0.8661    0.8948


ifail =

                    0


function g05rk_example
% Initialize the seed
seed = [int64(1762543)];
% genid and subid identify the base generator
genid = int64(1);
subid =  int64(1);
% Sample size
n = int64(13);
m = int64(4);
% Sample order
sorder = int64(1);
% Parameter
theta = 2.4;

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

% Generate variates
[state, x, ifail] = g05rk(n, m, theta, sorder, state)
 

state =

                   17
                 1234
                    1
                    0
                19862
                26460
                32347
                15920
                17917
                13895
                19930
                    8
                    0
                 1234
                    1
                    1
                 1234


x =

    0.9369    0.8676    0.9713    0.8854
    0.1139    0.3063    0.8625    0.2743
    0.4418    0.2211    0.5042    0.4985
    0.7902    0.6007    0.7493    0.6474
    0.8362    0.9847    0.8807    0.9079
    0.1781    0.4610    0.1283    0.1329
    0.1272    0.1760    0.1805    0.0383
    0.4473    0.2171    0.1662    0.1300
    0.8899    0.9005    0.8844    0.8879
    0.9069    0.8681    0.8450    0.8804
    0.2222    0.5499    0.4965    0.6488
    0.3807    0.5967    0.5096    0.3577
    0.8445    0.7755    0.8661    0.8948


ifail =

                    0



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–2013