Skip to contents

Dependence structures that draw uniforms, one vector per simulation. gaussian_copula() and t_copula() take a correlation matrix; t_copula() adds joint extremes through its degrees of freedom. archimedean_copula() is exchangeable: Clayton (lower-tail dependence), Gumbel and Joe (upper-tail dependence) or Frank (none). Kendall's tau is (2 / pi) * asin(r) for the Gaussian and t copulas, theta / (theta + 2) for Clayton and 1 - 1 / theta for Gumbel.

Usage

copula(ptr)

gaussian_copula(correlation)

t_copula(correlation, nu)

archimedean_copula(
  family = c("clayton", "gumbel", "frank", "joe"),
  theta,
  dim = 2
)

nested_archimedean_copula(family = c("clayton", "gumbel"), tree)

nac_node(theta, leaves = numeric(), children = list())

Arguments

ptr

Internal: an existing copula to wrap.

correlation

A symmetric correlation matrix, positive definite.

nu

Degrees of freedom, positive.

family

One of "clayton", "gumbel", "frank" and "joe".

theta

Positive for Clayton and Frank; at least 1 for Gumbel and Joe.

dim

Number of dimensions.

tree

For nested_archimedean_copula(), the root node, built with nac_node(theta, leaves, children): leaves the dimensions (1, 2, ...) joined at this level and children a list of nested nodes. Every dimension appears once, every node has at least two members, and no child's theta is below its parent's. Clayton or Gumbel only.

leaves, children

See tree.

Value

A copula object with dimension and description properties. Use it with copula_sample() and copula_simulate().

Details

nested_archimedean_copula() joins groups of dimensions by their own Archimedean copula and the groups by an outer one with weaker dependence, to any depth (McNeil 2008): Kendall's tau between two dimensions is that of the node where they first meet.

Examples

r <- matrix(c(1, 0.5, 0.5, 1), 2)
copula_sample(gaussian_copula(r), 3, seed = 1)
#>           [,1]      [,2]
#> [1,] 0.1583447 0.6435332
#> [2,] 0.1263656 0.1386217
#> [3,] 0.3262239 0.7234064
t_copula(r, nu = 4)
#> <copula> Student t, nu = 4, dimension 2
archimedean_copula("clayton", 2, dim = 3)
#> <copula> Clayton, theta = 2, dimension 3
nac <- nested_archimedean_copula("gumbel",
  nac_node(1.5, 1, list(nac_node(3, c(2, 3)), nac_node(2, c(4, 5)))))
copula_cdf(nac, c(1, 0.5, 1, 1, 1))
#> [1] 0.5