nvmix (version 0.0-3)

riskmeasures: Risk measures for normal variance mixtures

Description

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

Usage

VaRnvmix(level, qmix, loc = 0, scale = 1, control = list(), verbose = TRUE, ...)
ESnvmix(level, qmix, loc = 0, scale = 1, control = list(), verbose = TRUE, ...)

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()

Value

VaRnvmix() and ESnvmix() return a numeric \(n\)-vector with the computed risk measures and in case of ESnvmix() corresponding attributes "error"(error estimates of the RQMC estimator) and "numiter" (number of iterations).

Details

VaRnvmix calls qnvmix().

The function ESnvmix() 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. (2019), Normal variance mixtures: Distribution, density and parameter estimation. https://arxiv.org/abs/1911.03017.

See Also

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

Examples

Run this code
# NOT RUN {
## 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, ESnvmix() uses the closed formula
ES1 <- ESnvmix(level, qmix = "inverse.gamma", df = df)
## If 'qmix' is provided as function, the expected shortfall is estimated
ES2 <- ESnvmix(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