| pmvt {mvtnorm} | R Documentation |
Computes the the distribution function of the multivariate t distribution for arbitrary limits, degrees of freedom and correlation matrices based on algorithms by Genz and Bretz.
pmvt(lower, upper, df, corr, delta, maxpts=25000, abseps=0.001, releps=0)
lower |
the vector of lower limits of length n. |
upper |
the vector of upper limits of length n. |
df |
degree of freedom as integer. |
corr |
the correlation matrix of dimension n. |
delta |
the vector of noncentrality parameters of length n. |
maxpts |
maximum number of function values as integer. |
abseps |
absolute error tolerance as double. |
releps |
relative error tolerance as double. |
This program involves the computation of central and noncentral multivariate t-probabilities with arbitrary correlation matrices. It involves both the computation of singular and nonsingular probabilities. The methodology is described in Genz and Bretz (1999, 2001).
For a given correlation matrix corr, for short A, say,
(which has to be positive semi-definite) and
degrees of freedom df the following
values are numerically evaluated
I = K int s^{df-1} exp(-s^2/2) Phi(s cdot lower/sqrt{df}-delta, s cdot upper/sqrt{df}-delta) ds
where Phi(a,b) = K^prime int_a^b exp(-x^prime Ax/2) dx is the multivariate normal distribution, K^prime = 1/sqrt{det(A)(2π)^m} and K = 2^{1-df/2} / Gamma(df/2) are constants and the (single) integral of I goes from 0 to +Inf.
Note that both -Inf and +Inf may be specified in the lower and upper integral
limits. Randomized quasi-Monte Carlo methods are used for the computations.
Univariate problems are passed to pt.
Further information can be obtained from the quoted articles, which can be downloaded (together with additional material and additional codes) from the websites http://www.bioinf.uni-hannover.de/~bretz/ and http://www.sci.wsu.edu/math/faculty/genz/homepage.
A list with the following components:
value |
estimated integral value. |
error |
estimated absolute error. |
msg |
status messages. |
Fortran Code by Alan Genz <AlanGenz@wsu.edu> and Frank Bretz <bretz@ifgb.uni-hannover.de>, R port by Torsten Hothorn <Torsten.Hothorn@rzmail.uni-erlangen.de>
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, 361378.
Genz, A. and Bretz, F. (2001), Methods for the computation of multivariate t-probabilities. (submitted)
Edwards D. and Berry, Jack J. (1987), The efficiency of simulation-based multiple comparisons. Biometrics, 43, 913928
n <- 5
lower <- rep(-1, 5)
upper <- rep(3, 5)
df <- 4
corr <- diag(5)
corr[lower.tri(corr)] <- 0.5
delta <- rep(0, 5)
prob <- pmvt(lower, upper, df, corr , delta)
print(prob)
pmvt(-Inf, 3, df = 3, corr = 0)$value == pt(3, 3)
# Example from R News paper (original by Edwards and Berry, 1987)
n <- c(26, 24, 20, 33, 32)
V <- diag(1/n)
df <- 130
C <- c(1,1,1,0,0,-1,0,0,1,0,0,-1,0,0,1,0,0,0,-1,-1,0,0,-1,0,0)
C <- matrix(C, ncol=5)
cv <- C %*% V %*% t(C)
cr <- matrix(rep(0, ncol(cv)^2), ncol=ncol(cv))
for (i in 1:5) {
for (j in 1:5) {
cr[i,j] <- cv[i,j]/sqrt(cv[i,i]*cv[j,j] )
}
}
delta <- rep(0,5)
myfct <- function(q, alpha) {
lower <- rep(-q, ncol(cv))
upper <- rep(q, ncol(cv))
pmvt(lower, upper, df, cr, delta, abseps=0.0001)$value - alpha
}
round(uniroot(myfct, lower=1, upper=5, alpha=0.95)$root, 3)
# compare pmvt and pmvnorm for large df:
a <- pmvnorm(rep(-Inf, 5), rep(1, 5), mean=rep(0, 5), corr=diag(5))$value
b <- pmvt(rep(-Inf, 5), rep(1, 5), df=rep(300,5), corr=diag(5), delta=rep(0, 5))$value
a
b
stopifnot(round(a, 2) == round(b, 2))