Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rnchild

Sampling Child 'nacopula's


Description

Method for generating vectors of random numbers of nested Archimedean copulas which are child copulas.

Usage

rnchild(x, theta0, V0, ...)

Arguments

x

an "nacopula" object, typically emerging from an "outer_nacopula" object constructed with onacopula().

theta0

the parameter (vector) of the parent Archimedean copula which contains x as a child.

V0

a numeric vector of realizations of V0 following F0 whose length determines the number of generated vectors, that is, for each realization V0, a vector of variates from x is generated.

...

possibly further arguments for the given copula family.

Details

The generation is done recursively, descending the tree implied by the nested Archimedean structure. The algorithm is based on a mixture representation and requires sampling V01 ~ F01 given random variates V0 ~ F0. Calling "rnchild" is only intended for experts. The typical call of this function takes place through rnacopula().

Value

a list with components

U

a numeric matrix containing the vector of random variates from the child copula. The number of rows of this matrix therefore equals the length of V0 and the number of columns corresponds to the dimension of the child copula.

indcol

an integer vector of indices of U (the vector following a nested Archimedean copula of which x is a child) whose corresponding components of U are arguments of the nested Archimedean copula x.

See Also

rnacopula, also for the references. Further, classes "nacopula" and "outer_nacopula"; see also onacopula().

Examples

## Construct a three-dimensional nested Clayton copula with parameters
## chosen such that the Kendall's tau of the respective bivariate margins
## are 0.2 and 0.5.
theta0 <- copClayton@iTau(.2)
theta1 <- copClayton@iTau(.5)
C3 <- onacopula("C", C(theta0, 1, C(theta1, c(2,3))))
## Sample n random variates V0 ~ F0 (a Gamma(1/theta0,1) distribution)
n <- 1000
V0 <- copClayton@V0(n, theta0)

## Given these variates V0, sample the child copula, that is, the bivariate
## nested Clayton copula with parameter theta1
U23 <- rnchild(C3@childCops[[1]], theta0, V0)

## Now build the three-dimensional vectors of random variates by hand
U1 <- copClayton@psi(rexp(n)/V0, theta0)
U <- cbind(U1, U23$U)

## Plot the vectors of random variates from the three-dimensional nested
## Clayton copula
splom2(U)

copula

Multivariate Dependence with Copulas

v1.0-1
GPL (>= 3) | file LICENCE
Authors
Marius Hofert [aut] (<https://orcid.org/0000-0001-8009-4665>), Ivan Kojadinovic [aut] (<https://orcid.org/0000-0002-2903-1543>), Martin Maechler [aut, cre] (<https://orcid.org/0000-0002-8685-9910>), Jun Yan [aut] (<https://orcid.org/0000-0003-4401-7296>), Johanna G. Nešlehová [ctb] (evTestK(), <https://orcid.org/0000-0001-9634-4796>), Rebecca Morger [ctb] (fitCopula.ml(): code for free mixCopula weight parameters)
Initial release
2020-12-07

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.