The probability density function, the distribution function and random number generation for the multivariate Student's t distribution
1 2 3 4 5
either a vector of length
either a vector of length
a symmetric positive-definite matrix representing the
scale matrix of the distribution, such that
degrees of freedom; it must be a positive integer for
a logical value(default value is
parameters passed to
the number of random vectors to be generated
a numeric vector of lower integration limits of
the density function; must be of maximal length
a numeric vector of upper integration limits
of the density function; must be of maximal length
the maximum number of function evaluations
absolute error tolerance (default value:
relative error tolerance (default value:
biv.nt.prob are interfaces to
Fortran-77 routines by Alan Genz, and available from his web page;
they makes uses of some auxiliary functions whose authors are
documented in the Fortran code. The routine
sadmvt uses an adaptive
integration method. The routine
biv.nt.prob is specific for the
bivariate case; if
df=Inf, it computes the bivariate
normal distribution function using a non-iterative method described in a
reference given below.
pmt is called with
d>2, this is converted into
a suitable call to
d=2, a call to
biv.nt.prob is used; if
pt is used.
sqrt=NULL (default value), the working of
computation of a square root of
S via the Cholesky decomposition.
If a non-
NULL value of
sqrt is supplied, it is assumed that
it represents a square root of the scale matrix,
otherwise represented by
S, whose value is ignored in this case.
This mechanism is intended primarily for use in a sequence of calls to
rmt, all sampling from a distribution with fixed scale matrix;
a suitable matrix
sqrt can then be computed only once beforehand,
avoiding that the same operation is repeated multiple times along the
sequence of calls. For examples of use of this argument, see those in the
Another use of
sqrt is to supply a different form of square root
of the scale matrix, in place of the Cholesky factor.
For efficiency reasons,
rmt does not perform checks on the supplied
dmt returns a vector of density values (possibly log-transformed);
sadmvt return a single probability with
attributes giving details on the achieved accuracy, provided
pmnorm is a vector;
rmt returns a matrix of
n rows of random vectors
status of the probability returned
sadmvt and by
pmt (the latter only if
x is a vector
d>2) indicate whether the function
had a normal termination, achieving the required accuracy.
If this is not the case, re-run the function with a higher value of
Fortran code of
SADMVT and most auxiliary functions by Alan Genz,
some additional auxiliary functions by people referred to within his
program; interface to R and additional R code by Adelchi Azzalini.
Genz, A.: Fortran code in files
available at http://www.math.wsu.edu/math/faculty/genz/software/
Dunnett, C.W. and Sobel, M. (1954). A bivariate generalization of Student's t-distribution with tables for certain special cases. Biometrika 41, 153–169.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
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 # p0 <- pmt(c(2,11), mu[1:2], Sigma[1:2,1:2], df=5) p1 <- biv.nt.prob(5, lower=rep(-Inf,2), upper=c(2, 11), mu[1:2], Sigma[1:2,1:2]) p2 <- sadmvt(5, lower=rep(-Inf,2), upper=c(2, 11), mu[1:2], Sigma[1:2,1:2]) c(p0, p1, p2, p0-p1, p0-p2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.