Last data update: 2014.03.03

R: Construction of 'hac' objects
hacR Documentation

Construction of hac objects

Description

hac objects are required as input argument for several functions, e.g. plot.hac and rHAC. They can be constructed by hac and hac.full. The latter function produces only fully nested Archimedean copulae, whereas hac can construct arbitrary dependence structures for a given family. Moreover, the functions hac2nacopula and nacopula2hac ensure the compatability with the copula package.

Usage

hac(type, tree)
hac.full(type, y, theta)
## S3 method for class 'hac'
print(x, digits = 2, ...)
hac2nacopula(x)
nacopula2hac(outer_nacopula)

Arguments

y

a vector containing the variables, which are denoted by a character, e.g. "X1".

theta

a vector containing the HAC parameters, which should be ordered from top to down. The length of theta must be equal to length(y) - 1.

tree

a list object of the general structure list(..., numeric(1)). The last argument of the list, numeric(1), denotes the dependency parameter. The arguments ... are either of the same structure or of the class character. The character objects denote variables and embedded lists refer to nested subcopulae.

type

all copula-types are admissible, see phi for an overview of implemented families.

x

a hac object.

outer_nacopula

an nacopula object. The variables of the outer_nacopula object 1, 2, ... are translated into the characters "X1", "X2", ....

digits

specifies the digits, see tree2str.

...

arguments to be passed to cat.

Value

A hac object is returned.

type

the specified copula type.

tree

the structure of the HAC.

References

Hofert, M. and Maechler, M. 2011, Nested Archimedean Copulas Meet R: The nacopula Package, Journal of Statistical Software, 39(9), 1-20, http://www.jstatsoft.org/v39/i09/.

Hofert, M., Kojadinovic, I., Maechler, M. and Yan, J. 2013, copula: Multivariate Dependence with Copulas, R package version 0.999-7, http://CRAN.R-project.org/package=copula.

Kojadinovic, I., Yan, J. 2010, Modeling Multivariate Distributions with Continuous Margins Using the copula R Package, Journal of Statistical Software, 34(9), 1-20. http://www.jstatsoft.org/v34/i09/.

Okhrin, O. and Ristig, A. 2014, Hierarchical Archimedean Copulae: The HAC Package", Journal of Statistical Software, 58(4), 1-20, http://www.jstatsoft.org/v58/i04/.

Yan, J. 2007, Enjoy the Joy of Copulas: With a Package copula, Journal of Statistical Software, 21(4), 1-21, http://www.jstatsoft.org/v21/i04/.

Examples

# it might be helpful to plot the hac objects
# Example 1: 4-dim AC
tree = list("X1", "X2", "X3", "X4", 2)
AC = hac(type = 1, tree = tree)

# Example 2: 4-dim HAC
y = c("X1", "X4", "X3", "X2")
theta = c(2, 3, 4)

HAC1 = hac.full(type = 1, y = y, theta = theta)
HAC2 = hac(type = 1, tree = list(list(list("X2", "X3", 4), 
"X4", 3), "X1", 2))
tree2str(HAC1) == tree2str(HAC2) # [1] TRUE

# Example 3: 9-dim HAC

HAC = hac(type = 1, tree = list("X6", "X5", list("X2", "X4", "X3", 4.4),
list("X1", "X7", 3.3), list("X8", "X9", 4), 2.3))
plot(HAC)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(HAC)
Loading required package: copula
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/HAC/hac.Rd_%03d_medium.png", width=480, height=480)
> ### Name: hac
> ### Title: Construction of 'hac' objects
> ### Aliases: hac hac.full print.hac hac2nacopula nacopula2hac
> 
> ### ** Examples
> 
> # it might be helpful to plot the hac objects
> # Example 1: 4-dim AC
> tree = list("X1", "X2", "X3", "X4", 2)
> AC = hac(type = 1, tree = tree)
> 
> # Example 2: 4-dim HAC
> y = c("X1", "X4", "X3", "X2")
> theta = c(2, 3, 4)
> 
> HAC1 = hac.full(type = 1, y = y, theta = theta)
> HAC2 = hac(type = 1, tree = list(list(list("X2", "X3", 4), 
+ "X4", 3), "X1", 2))
> tree2str(HAC1) == tree2str(HAC2) # [1] TRUE
[1] TRUE
> 
> # Example 3: 9-dim HAC
> 
> HAC = hac(type = 1, tree = list("X6", "X5", list("X2", "X4", "X3", 4.4),
+ list("X1", "X7", 3.3), list("X8", "X9", 4), 2.3))
> plot(HAC)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>