nvmix (version 0.0-3)

qqplot_maha: QQ Plot for Multivariate Normal Variance Mixtures

Description

Visual goodness-of-fit test for multivariate normal variance mixtures: Plotting squared Mahalanobis distances against their theoretical quantiles.

Usage

qqplot_maha(x, qmix, loc, scale, plot.diag = TRUE, verbose = TRUE,
            control = list(), ...)

Arguments

x

\((n, d)\)-data matrix.

qmix

see pnvmix().

loc

see pnvmix().

scale

see pnvmix().

plot.diag

logical indicating if the diagonal \(y=x\) shall be included in the plot.

verbose

see pnvmix().

control

list specifying algorithm specific parameters; see get_set_param().

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

Value

qqplot_maha() (invisibly) returns a list of two: maha2, the sorted Mahalanobis distances of the data in x with respect to loc and scale and q, the theoretical quantiles evaluated at ppoints(n) where n=nrow(x).

Details

If \(X\) follows a multivariate normal variance mixture, the distribution of the Mahalanobis distance \(D^2 = (X-\mu)^T \Sigma^{-1} (X-\mu)\) is a gamma mixture whose distribution can be approximated. The function qqplot_maha() plots the empirical Mahalanobis distances from the data in x (with \(\mu=\)loc and \(Sigma=\)scale) versus their theoretical quantiles which are internally estimated via the function qgammamix().

References

Hintz, E., Hofert, M. and Lemieux, C. (2019), Normal variance mixtures: Distribution, density and parameter estimation. https://arxiv.org/abs/1911.03017.

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

fitnvmix(), rnvmix(), pnvmix()

Examples

Run this code
# NOT RUN {
## Setup
n     <- 15
d     <- 2
df    <- 3.1 # degree-of-freedom parameter
loc   <- rep(0, d)
scale <- diag(d)
## Define the quantile function of an IG(nu/2, nu/2) distribution
qmix <- function(u, df) 1 / qgamma(1 - u, shape = df/2, rate = df/2)
## Sample data
set.seed(1) # for reproducibility
x <- rnvmix(n, qmix = qmix, df = df, loc = loc, scale = scale)
## QQ Plot of empirical quantiles vs true quantiles, all values estimated 
## via RQMC:
qqplot_maha(x, qmix = qmix, loc = loc, scale = scale, df = df)
## Same could be obtained by specifying 'qmix' as string in which case
## qqplot_maha() calls qf()
qqplot_maha(x, qmix = "inverse.gamma", loc = loc, scale = scale, df = df)
# }

Run the code above in your browser using DataLab