emp.copula {HAC}R Documentation

Empirical copula

Description

emp.copula and emp.copula.self compute the empirical copula for a given sample. The difference between these functions is, that emp.copula.self does not require a matrix u, at which the function is evaluated.

Usage

emp.copula(u, x, proc = "M", sort = "none", margins = NULL, 
na.rm = FALSE, ...)
emp.copula.self(x, proc = "M", sort = "none", margins = NULL, 
na.rm = FALSE, ...)

Arguments

u

a matrix, at which the function is evaluated. According to the dimension of the data matrix x, it can be a scalar, a vector or a matrix. The entries of u should be within the interval [0, 1].

x

denotes the matrix of marginal distributions, if margins = NULL. The number of columns should be equal the dimension d, whereas the number of rows should be equal to the number of observations n, with n > d.

proc

enables the user to choose between two different methods. It is recommended to use the default method, "M", because it takes only a small fraction of the computational time of method "A". However, method "M" is sensitive with respect to the size of the working memory and therefore, non-applicable for very large datasets.

sort

defines, whether the output is ordered. sort = "asc" refers to ascending values, which might be interesting for plotting and sort = "desc" refers to descending values.

margins

specifies the margins. The data matrix is assumed to contain the values of the marginal distributions by default, i.e. margins = NULL. If raw data are used, the margins can be determined nonparametrically, "edf", or in parametric way, e.g. "norm". See estimate.copula for a detailed explanation.

na.rm

boolean. If na.rm = TRUE, missing values, NA, contained in x and u are removed.

...

arguments to be passed to na.omit.

Details

The estimated copula follows the formula

\widehat{C} \left(u_{1}, \dots, u_{d} \right) = n^{-1} \sum_{i=1}^{n} \prod_{j=1}^{d} \mathbf{I} \left\{ \widehat{F}_{j} \left( X_{ij} \right) \leq u_{j} \right\},

where \widehat{F}_{j} denotes the empirical marginal distribution function of variable X_{j}.

Value

A vector containing the values of the empirical copula.

References

Okhrin, O. and Ristig, A. 2014, Hierarchical Archimedean Copulae: The ⁠HAC⁠ Package", Journal of Statistical Software, 58(4), 1-20, doi: 10.18637/jss.v058.i04.

See Also

pHAC

Examples

v = seq(-4, 4, 0.05)
X = cbind(matrix(pt(v, 1), 161, 1), matrix(pnorm(v), 161, 1))

# both methods lead to the same result 
z = emp.copula.self(X, proc = "M") 
which(((emp.copula.self(X[1:100, ], proc = "M") - emp.copula.self(X[1:100, ],
proc = "A")) == 0) == "FALSE")
# integer(0)

# the contour plot
out = outer(z, z)
contour(x = X[,1], y = X[,2], out, main = "Contour Plot", 
xlab = "Cauchy Margin", ylab = "Standard Normal Margin", 
labcex = 1, lwd = 1.5, nlevels = 15)

[Package HAC version 1.1-0 Index]