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 |
denotes the matrix of marginal distributions, if |
proc |
enables the user to choose between two different methods. It is recommended to use the default method, |
sort |
defines, whether the output is ordered. |
margins |
specifies the margins. The data matrix is assumed to contain the values of the marginal distributions by default, i.e. |
na.rm |
boolean. If |
... |
arguments to be passed to |
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
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)