dependencemeasures {nvmix} | R Documentation |
Dependence Measures for grouped normal variance mixture copulas
Description
Computation of rank correlation coefficients Spearman's rho and Kendall's tau for grouped normal variance mixture copulas as well as computation of the (lower and upper) tail dependence coefficient of a grouped t copula.
Usage
corgnvmix(scale, qmix, method = c("kendall", "spearman"), groupings = 1:2,
ellip.kendall = FALSE, control = list(), verbose = TRUE, ...)
lambda_gStudent(df, scale, control = list(), verbose = TRUE)
Arguments
scale |
|
qmix |
specification of the mixing variables; see |
method |
|
groupings |
|
ellip.kendall |
|
df |
either scalar or |
control |
|
verbose |
|
... |
additional arguments (for example, parameters) passed
to the underlying mixing distribution when |
Details
For grouped normal variance mixture copulas, including the grouped t,
there is no closed formula for Kendall's tau and Spearman's rho. The function
corgnvmix()
approximates these dependence measures by numerically
approximating an integral representation for these measures.
If no grouping is present (i.e., when groupings = rep(1, 2)
), the
copula is an elliptical copula for which the formula \tau = 2asin(\rho)/pi
holds. This formula holds only approximately in the grouped case; the quality
of the approximation depends on how different the mixing variables for the
two components are. When the mixing distributions are not too far apart and
when the copula parameter is not close to 1, this approximation is “very
accurate“, as demonstrated in Daul et al (2003).
In the ungrouped case, lambda_gStudent()
computes the tail dependence
coefficient lambda
based on the known formula
2 * pt( -sqrt( (df + 1)*(1 - rho) / (1 + rho)), df = df + 1)
for
the tail dependence coefficient of a t copula.
In the grouped case, RQMC methods are used to efficiently approximate the integral given in Eq. (26) of Luo and Shevchenko (2010).
Value
lambda_gStudent()
and corgnvmix()
return
a numeric
n
-vector with the computed
dependence measure with corresponding attributes
"abs. error"
and "rel. error"
(error estimates of the RQMC estimator)
and "numiter"
(number of iterations).
Author(s)
Erik Hintz, Marius Hofert and Christiane Lemieux
References
Hintz, E., Hofert, M. and Lemieux, C. (2020), Grouped Normal Variance Mixtures. Risks 8(4), 103.
Hintz, E., Hofert, M. and Lemieux, C. (2021), Normal variance mixtures: Distribution, density and parameter estimation. Computational Statistics and Data Analysis 157C, 107175.
Hintz, E., Hofert, M. and Lemieux, C. (2022), Multivariate Normal Variance Mixtures in R: The R Package nvmix. Journal of Statistical Software, doi:10.18637/jss.v102.i02.
Luo, X. and Shevchenko, P. (2010). The t copula with multiple parameters of degrees of freedom: bivariate characteristics and application to risk management. Quantitative Finance 10(9), 1039-1054.
Daul, S., De Giorgi, E. G., Lindskog, F. and McNeil, A (2003). The grouped t copula with an application to credit risk. Available at SSRN 1358956.
See Also
dgStudentcopula()
, pgStudentcopula()
,
rgStudentcopula()
Examples
### Examples for corgnvmix() ###################################################
## Create a plot displaying Spearman's rho for a grouped t copula as a function
## of the copula parameter for various choices of the degrees-of-freedom
qmix <- "inverse.gamma"
df <- matrix( c(1, 2, 1, 5, 1, Inf), ncol = 2, byrow = TRUE)
l.df <- nrow(df)
scale <- seq(from = 0, to = 1, length.out = 99)
set.seed(1) # for reproducibility
kendalls <- sapply(seq_len(l.df), function(i)
corgnvmix(scale, qmix = qmix, method = "kendall", df = df[i, ]))
## Include the elliptical approximation (exact when df1 = df2)
kendall_ell <- corgnvmix(scale, method = "kendall", ellip.kendall = TRUE)
## Plot
lgnd <- character(l.df + 1)
lgnd[1] <- "elliptical (equal df)"
plot(NA, xlim = c(0, 1), ylim = c(0, 1), xlab = expression(rho),
ylab = "Kendall's tau")
lines(scale, kendall_ell, lty = 1)
for(i in 1:l.df){
lines(scale, kendalls[, i], col = i + 1, lty = i + 1)
lgnd[i+1] <- paste0("df1 = ", df[i, 1], ", df2 = ", df[i, 2])
}
legend("topleft", lgnd, col = 1:(l.df + 1), lty = 1:(l.df + 1), bty = 'n')
### Examples for lambda_gStudent() #############################################
## Create a plot displaying 'lambda' as a function of the copula parameter
## for various choices of the degrees-of-freedom
df <- c(3, 6, 9)
df_ <- list( rep(df[1], 2), rep(df[2], 2), rep(df[3], 2), # ungrouped
c(df[1], df[2]), c(df[1], df[3]), c(df[2], df[3])) # grouped
l.df_ <- length(df_)
scale <- seq(from = -0.99, to = 0.99, length.out = 112) # scale parameters
set.seed(1) # for reproducibilty
lambdas <-
sapply(seq_len(l.df_), function(i) lambda_gStudent(df_[[i]], scale = scale))
lgnd <- character(length(df_))
plot(NA, xlim = range(scale), ylim = range(lambdas), xlab = expression(rho),
ylab = expression(lambda))
for(i in seq_len(l.df_)){
lines(scale, lambdas[, i], col = i, lty = i)
lgnd[i] <- if(df_[[i]][1] == df_[[i]][2]) paste0("df = ", df_[[i]][1]) else
paste0("df1 = ", df_[[i]][1], ", df2 = ", df_[[i]][2])
}
legend("topleft", lgnd, col = seq_len(l.df_), lty = seq_len(l.df_),
bty = 'n')
## If called with 'df' a 1-vector, closed formula for lambda is used => check
lambda.true <- sapply(1:3, function(i) lambda_gStudent(df_[[i]][1], scale = scale))
stopifnot(max(abs( lambda.true - lambdas[, 1:3])) < 4e-4)