Learn R Programming

copula (version 0.999-1)

onacopula: Constructing (outer) nested Archimedean copulas

Description

Constructing (outer) nested Archimedean copulas (class outer_nacopula) is most conveniently done via onacopula(), using a nested $C(...)$ notation.

Slightly less conveniently, but with the option to pass a list structure, onacopulaL() can be used, typically from inside another function programmatically.

Usage

onacopula (family, nacStructure)
onacopulaL(family, nacList)
nac2list(x)

Arguments

family
either a character string, the short or longer form of the Archimedean family name (for example, "Clayton" or simply "C"); see the acopula-families
a list of length 3 (or 2), with elements
  1. theta:$\theta$
  2. comp: components$c(i_1,\dots,i_c)$
  3. children: alistwhich must be a<
x
an "nacopula", (typically "outer_nacopula") object.

Value

  • onacopula[L](): An outer nested Archimedean copula object, that is, of class "outer_nacopula".

    nac2list: a list exactly like the naclist argument to onacopulaL.

References

Those of the Archimedean families, for example, copGumbel.

See Also

The class definitions "nacopula", "outer_nacopula", and "acopula".

Examples

Run this code
## Construct a ten-dimensional Joe copula with parameter such that
## Kendall's tau equals 0.5
theta <- copJoe@tauInv(0.5)
C10 <- onacopula("J",C(theta,1:10))

## Equivalent construction with onacopulaL():
C10. <- onacopulaL("J",list(theta,1:10))
stopifnot(identical(C10, C10.),
          identical(nac2list(C10), list(theta, 1:10)))

## Construct a three-dimensional nested Gumbel copula with parameters
## such that Kendall's tau of the respective bivariate margins are 0.2
## and 0.5.
theta0 <- copGumbel@tauInv(.2)
theta1 <- copGumbel@tauInv(.5)
C3 <- onacopula("G", C(theta0, 1, C(theta1, c(2,3))))

## Equivalent construction with onacopulaL():
str(NAlis <- list(theta0, 1, list(list(theta1, c(2,3)))))
C3. <- onacopulaL("Gumbel", NAlis)
stopifnot(identical(C3, C3.))

## Good error message if the component ("coordinate") indices are wrong
## or do not match:
err <- try(onacopula("G", C(theta0, 2, C(theta1, c(3,2)))))

## Compute the probability of falling in [0,.01]^3 for this copula
pnacopula(C3, rep(.01,3))

## Compute the probability of falling in the cube [.99,1]^3
prob(C3, rep(.99, 3), rep(1, 3))

Run the code above in your browser using DataLab