nvmix (version 0.1-1)

riskmeasures: Risk measures for normal variance mixtures

Description

Estimation of value-at-risk and expected shortfall for univariate normal variance mixtures

Usage

VaR_nvmix(level, qmix, loc = 0, scale = 1, control = list(), verbose = TRUE, ...)
ES_nvmix(level, qmix, loc = 0, scale = 1, control = list(), verbose = TRUE, ...)

Value

VaR_nvmix() and ES_nvmix() return a numeric

\(n\)-vector with the computed risk measures and in case of ES_nvmix() corresponding attributes

"abs. error" and "rel. error"(error estimates of the RQMC estimator) and "numiter" (number of iterations).

Arguments

level

\(n\)-vector of confidence levels.

qmix

see pnvmix().

loc

numeric location, see also pnvmix()

scale

numeric scale, see also pnvmix()

control

list specifying algorithm specific parameters; see get_set_param().

verbose

logical indicating whether a warning is given if the required precision has not been reached.

...

additional arguments (for example, parameters) passed to the underlying mixing distribution when qmix is a character string or function, see also pnvmix()

Author

Erik Hintz, Marius Hofert and Christiane Lemieux

Details

VaR_nvmix calls qnvmix().

The function ES_nvmix() estimates the expected shortfall using a randomized quasi Monte Carlo procedure by sampling from the mixing variable specified via qmix and and using the identity \(\int_k^{\infty} x\phi(x)dx=\phi(k)\) where \(\phi(x)\) denotes the density of a standard normal distribution. Algorithm specific paramaters (such as tolerances) can be conveniently passed via the control argument, see get_set_param() for more details.

References

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, tools:::Rd_expr_doi("10.18637/jss.v102.i02").

See Also

dnvmix(), pnvmix(), qnvmix(), rnvmix(), get_set_param()

Examples

Run this code
## Example for inverse-gamma mixture (resulting in a t distribution) for
## which the expected shortfall admits a closed formula
set.seed(42) # reproducibility
level <- seq(from = 0.9, to = 0.95, by = 0.01)
df <- 4
## If 'qmix' is provided as string, ES_nvmix() uses the closed formula
ES1 <- ES_nvmix(level, qmix = "inverse.gamma", df = df)
## If 'qmix' is provided as function, the expected shortfall is estimated
ES2 <- ES_nvmix(level, qmix = function(u, df) 1/qgamma(1-u, shape = df/2, rate = df/2),
       df = df)
stopifnot(all.equal(ES1, ES2, tol = 1e-2, check.attributes = FALSE))

Run the code above in your browser using DataLab