Learn R Programming

mnormt (version 1.2-1)

dmt: Multivariate t distribution

Description

The probability density function, the distribution function and random number generation for the multivariate t probability distribution

Usage

dmt(x, mean = rep(0, d), S, df=Inf, log = FALSE) 
pmt(x, mean = rep(0, length(x)), S, df=Inf, ...) 
rmt(n = 1, mean = rep(0, d), S, df=Inf) 
sadmvt(df, lower, upper, mean, S, maxpts = 2000 * d, abseps = 1e-06, releps = 0)

Arguments

x
for dmt, this is either a vector of length d or a matrix with d columns, where d=ncol(S), giving the coordinates of the point(s) where the density must be evaluated; for pmt, on
mean
a numeric vector representing the location parameter of the distribution (equal to the expected value when df>1); it must be of length d, as defined above
S
a positive definite matrix representing the scale matrix of the distribution, such that S*df/(df-2) is the variance-covariance matrix when df>2; a vector of length 1 is also allowed (in this cas
df
degrees of freedom; it must be a positive integer for pmt and sadmvt, otherwise a positive number; if df=Inf (default value), the corresponding *mnorm function is called
log
a logical value; if TRUE, the logarithm of the density is computed
...
parameters passed to sadmvt, among maxpts, absrel, releps
n
the number of random numbers to be generated
lower
a numeric vector of lower integration limits of the density function; must be of maximal length 20; +Inf and -Inf entries are allowed
upper
a numeric vector of upper integration limits of the density function; must be of maximal length 20; +Inf and -Inf entries are allowed
maxpts
the maximum number of function evaluations (default value: 2000*d)
abseps
absolute error tolerance (default value: 1e-6)
releps
relative error tolerance (default value: 0)

Value

  • dmt returns a vector of density values (possibly log-transformed); pmt and sadmvt return a single probability with attributes giving details on the achieved accuracy; rmt returns a matrix of n rows of random vectors

Details

Function sadmvt is an interface to a Fortran-77 routine with the same name written by Alan Genz, and available from his web page; this makes uses of some auxiliary functions whose authors are documented in the Fortran code. The routine uses an adaptive integration method.

References

Genz, A.: Fortran code available at http://www.math.wsu.edu/math/faculty/genz/software/mvt.f

See Also

dt, dmnorm

Examples

Run this code
x <- seq(-2,4,length=21)
y <- 2*x+10
z <- x+cos(y) 
mu <- c(1,12,2)
Sigma <- matrix(c(1,2,0,2,5,0.5,0,0.5,3), 3, 3)
df <- 4
f  <- dmt(cbind(x,y,z), mu, Sigma,df)
p1 <- pmt(c(2,11,3), mu, Sigma, df)
p2 <- pmt(c(2,11,3), mu, Sigma, df, maxpts=10000, abseps=1e-8)
x  <- rmt(10, mu, Sigma, df)
p  <- sadmvt(df, lower=c(2,11,3), upper=rep(Inf,3), mu, Sigma) # upper tail

Run the code above in your browser using DataLab