Quantiles of the Multivariate Normal Distribution
qmvnorm.RdComputes the equicoordinate quantile function of the multivariate normal
distribution for arbitrary correlation matrices
based on inversion of pmvnorm, using a stochastic root
finding algorithm described in Bornkamp (2018).
Arguments
- p
probability.
- interval
optional, a vector containing the end-points of the interval to be searched. Does not need to contain the true quantile, just used as starting values by the root-finder. If equal to NULL a guess is used.
- tail
specifies which quantiles should be computed.
lower.tailgives the quantile \(x\) for which \(P[X \le x] = p\),upper.tailgives \(x\) with \(P[X > x] = p\) andboth.tailsleads to \(x\) with \(P[-x \le X \le x] = p\).- mean
the mean vector of length n.
- corr
the correlation matrix of dimension n.
- sigma
the covariance matrix of dimension n. Either
corrorsigmacan be specified. Ifsigmais given, the problem is standardized internally. Ifcorris given, it is assumed that appropriate standardization was performed by the user. If neithercorrnorsigmais given, the identity matrix is used forsigma.- algorithm
an object of class
GenzBretz,MiwaorTVPACKspecifying both the algorithm to be used as well as the associated hyper parameters.- ptol, maxiter, trace
Parameters passed to the stochastic root-finding algorithm. Iteration stops when the 95% confidence interval for the predicted quantile is inside [p-ptol, p+ptol].
maxiteris the maximum number of iterations for the root finding algorithm.traceprints the iterations of the root finder.- seed
an object specifying if and how the random number generator should be initialized, see
simulate.- ...
additional parameters to be passed to
GenzBretz.
Details
Only equicoordinate quantiles are computed, i.e., the quantiles in each dimension coincide. The result is seed dependend. The concept is explained in mvtnorm::Bornkamp:2018.
Value
A list with two components: quantile and f.quantile
give the location of the quantile and the difference between the distribution
function evaluated at the quantile and p.
Examples
qmvnorm(0.95, sigma = diag(2), tail = "both")
#> $quantile
#> [1] 2.236422
#>
#> $f.quantile
#> [1] -1.310417e-06
#>
#> attr(,"message")
#> [1] "Normal Completion"