Learn R Programming

HAC (version 0.1-7)

dAC, dHAC: Probability density function

Description

dHAC returns the values of the pdf for 3-dimensional HAC, whereas the function dAC returns the values of a pdf for 2-dim AC.

Usage

dHAC(X, hac, margins = NULL, na.rm = FALSE, max.min = TRUE)
dAC(x, y, theta = 1.0, type = AC_GUMBEL, na.rm = FALSE, max.min = TRUE)

Arguments

hac
an object of the class hac.
theta
the dependency parameter of the copula.
type
choose between AC_GUMBEL, AC_CLAYTON and GAUSS.
X
a data matrix. The number of columns ($2$ or $3$) has to coincide with the dimension of the corresponding copula model. X has to contain at least to rows (observations), because the values of the pdf cannot be computed else. The column names
x, y
data vectors.
margins
scalar or vector specifying how the margins are to compute. They can be determined nonparametrically denoted by "edf" or in parametric way , e.g. "norm". See estimate.copula
na.rm
boolean. If na.rm = TRUE and a row of X contains NA, the row is removed and not used for the computation. Corresponding warnings are shown.
max.min
boolean. If max.min = TRUE and an element of X is $\geq 1$ or $\leq 0$, it is set to $1-10^{-6}$ and $10^{-6}$ respectively.

Value

  • A vector containing the values of the pdf.

Details

To do: extending the dimension of dHAC.

References

Savu, C. and Trede, M. 2010, Hierarchies of Archimedean copulas, Quantitative Finance 10, 295-304.

See Also

pHAC

Examples

Run this code
# AC example
# the underlying model
g.model = hac(type = AC_GUMBEL, X = 1.5, dim = 2)

# sample from copula g.model
sample = rHAC(100, g.model)

# returns the pdf at each point of the sample
values_1 = dHAC(sample, g.model)
values_2 = dAC(sample[, 1], sample[, 2], theta = 1.5, type = AC_GUMBEL)
round(values_1) == round(values_2) # TRUE


# HAC example
# the underlying model
y = c(~X1, ~X2, ~X3)
theta = c(1.5, 3)
g.model = hac.full(type = HAC_GUMBEL, y, theta)

# sample from copula g.model
sample = rHAC(100, g.model)

# returns the pdf at each point of the sample
values = dHAC(sample, g.model)

Run the code above in your browser using DataLab