pgnvmix function

Distribution Function of Grouped Multivariate Normal Variance Mixtures

Distribution Function of Grouped Multivariate Normal Variance Mixtures

Evaluating grouped and generalized multivariate normal variance mixture distribution functions (including Student t with multiple degrees-of-freedom).

pgnvmix(upper, lower = matrix(-Inf, nrow = n, ncol = d), groupings = 1:d, qmix, rmix, loc = rep(0, d), scale = diag(d), standardized = FALSE, control = list(), verbose = TRUE, ...) pgStudent(upper, lower = matrix(-Inf, nrow = n, ncol = d), groupings = 1:d, df, loc = rep(0, d), scale = diag(d), standardized = FALSE, control = list(), verbose = TRUE)

Arguments

  • upper: see pnvmix().

  • lower: see pnvmix().

  • groupings: dd-vector. Specification of the groupings so that variable ii has mixing variable WkW_k where k = groupings[i]. If groupings = 1:d, each variable has a different mixing distribution.

  • qmix: specification of the mixing variables WiW_i via quantile functions; see McNeil et al. (2015, Chapter 6) and Hintz et al. (2020). Supported are the following types of specification (see also the examples below):

    • character:: character string specifying a supported distribution; currently available are "inverse.gamma" (in which case WiW_i is inverse gamma distributed with shape and rate parameters df[groupings[i]]/2 and a multivariate Student t distribution multiple degreess-of-freedom results) and "pareto" (in which case WiW_i is Pareto distributed with scale equal to unity and shape equal to alpha[groupings[i]]. alpha and df must be of length length(unique(groupings)) and need to be provided via the ellipsis argument).

    • list:: list of length length(unique(groupings)) (number of different mixing distributions). Element ii of this list specifies the mixing variable for component groupings[i]. Each element of this list can be

       - **`list`:**: a `list` of length at least one, where the first component is a `character`
              
              string specifying the base name of a distribution whose quantile function can be accessed via the prefix `"q"`. An example `"exp"` for which `"qexp"` exists. If the list is of length larger than one, the remaining elements contain additional parameters of the distribution; for `"exp"`, for example, this can be the parameter `rate`.
       - **`function`:**: `function`
              
              interpreted as the quantile function or random number generator of the mixing variable $W_i$ 
      
  • rmix: only allowed when groupings = rep(1, d) in which case pgnvmix() is equivalent to pnvmix(); see pnvmix().

  • df: vector of length length(unique(groupings)) so that variable i has degrees-of-freedom df[groupings[i]]; all elements must be positive and can be Inf, in which case the corresponding marginal is normally distributed.

  • loc: see pnvmix().

  • scale: see pnvmix(); must be positive definite.

  • standardized: see pnvmix().

  • control: list specifying algorithm specific parameters; see get_set_param().

  • verbose: see pnvmix().

  • ...: additional arguments (for example, parameters) passed to the underlying mixing distribution when qmix is a character string or an element of qmix is a function.

Returns

pgnvmix() and pgStudent() return a numeric nn-vector with the computed probabilities and corresponding attributes "abs. error" and "rel. error"

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

Details

One should highlight that evaluating grouped normal variance mixtures is a non-trivial tasks which, at the time of development of nvmix, was not available in before, not even the special case of a multivariate Student t distribution for non-integer degrees of freedoms, which frequently appears in applications in finance, insurance and risk management after estimating such distributions.

Internally, an iterative randomized Quasi-Monte Carlo (RQMC) approach is used to estimate the probabilities. It is an iterative algorithm that evaluates the integrand at a point-set (with size as specified by control$increment in the control argument) in each iteration until the pre-specified absolute error tolerance control$pnvmix.abstol (or relative error tolerance control$pnvmix.reltol which is used only when control$pnvmix.abstol = NA) is reached. The attribute "numiter" gives the number of such iterations needed. Algorithm specific parameters (such as the above mentioned control$pnvmix.abstol) can be passed as a list via control, see get_set_param() for more details. If specified error tolerances are not reached and verbose = TRUE, a warning is thrown.

pgStudent() is a wrapper of pgnvmix(, qmix = "inverse.gamma", df = df).

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 : The Package nvmix. Journal of Statistical Software, tools:::Rd_expr_doi("10.18637/jss.v102.i02") .

McNeil, A. J., Frey, R. and Embrechts, P. (2015). Quantitative Risk Management: Concepts, Techniques, Tools. Princeton University Press.

Genz, A. and Bretz, F. (1999). Numerical computation of multivariate t-probabilities with application to power calculation of multiple contrasts. Journal of Statistical Computation and Simulation 63(4), 103--117.

Genz, A. and Bretz, F. (2002). Comparison of methods for the computation of multivariate t

probabilities. Journal of Computational and Graphical Statistics 11(4), 950--971.

See Also

rgnvmix(), dgnvmix(), get_set_param()

Examples

### Examples for pgnvmix() ##################################################### ## 1. Inverse-gamma mixture (=> distribution is grouped t with mutliple dof) d <- 3 set.seed(157) A <- matrix(runif(d * d), ncol = d) P <- cov2cor(A %*% t(A)) a <- -3 * runif(d) * sqrt(d) # random lower limit b <- 3 * runif(d) * sqrt(d) # random upper limit df <- c(1.1, 2.4, 4.9) # dof for margin i groupings <- 1:d ### Call 'pgnvmix' with 'qmix' a string: set.seed(12) (pgt1 <- pgnvmix(b, lower = a, groupings = groupings, qmix = "inverse.gamma", df = df, scale = P)) ### Version providing quantile functions of the mixing distributions as list qmix_ <- function(u, df) 1 / qgamma(1-u, shape = df/2, rate = df/2) qmix <- list(function(u) qmix_(u, df = df[1]), function(u) qmix_(u, df = df[2]), function(u) qmix_(u, df = df[3])) set.seed(12) (pgt2 <- pgnvmix(b, lower = a, groupings = groupings, qmix = qmix, scale = P)) ### Similar, but using ellipsis argument: qmix <- list(function(u, df1) qmix_(u, df1), function(u, df2) qmix_(u, df2), function(u, df3) qmix_(u, df3)) set.seed(12) (pgt3 <- pgnvmix(b, lower = a, groupings = groupings, qmix = qmix, scale = P, df1 = df[1], df2 = df[2], df3 = df[3])) ## Version using the user friendly wrapper 'pgStudent()' set.seed(12) (pgt4 <- pgStudent(b, lower = a, groupings = groupings, scale = P, df = df)) stopifnot(all.equal(pgt1, pgt2, tol = 1e-4, check.attributes = FALSE), all.equal(pgt2, pgt3), all.equal(pgt1, pgt4)) ## 2. More complicated mixutre ## Let W1 ~ IG(1, 1), W2 = 1, W3 ~ Exp(1), W4 ~ Par(2, 1), W5 = W1, all comonotone ## => X1 ~ t_2; X2 ~ normal; X3 ~ Exp-mixture; X4 ~ Par-mixture; X5 ~ t_2 d <- 5 set.seed(157) A <- matrix(runif(d * d), ncol = d) P <- cov2cor(A %*% t(A)) b <- 3 * runif(d) * sqrt(d) # random upper limit groupings <- c(1, 2, 3, 4, 1) # since W_5 = W_1 qmix <- list(function(u) qmix_(u, df = 2), function(u) rep(1, length(u)), list("exp", rate=1), function(u) (1-u)^(-1/2)) # length 4 (# of groups) pg1 <- pgnvmix(b, groupings = groupings, qmix = qmix, scale = P) stopifnot(all.equal(pg1, 0.78711, tol = 5e-6, check.attributes = FALSE))
  • Maintainer: Marius Hofert
  • License: GPL (>= 3) | file LICENCE
  • Last published: 2024-03-04

Useful links