The Multivariate t Distribution
Description
These functions provide information about the multivariate t
distribution with noncentrality parameter (or mode) delta
,
scale matrix sigma
and degrees of freedom df
.
dmvt
gives the density and rmvt
generates random deviates.
Usage
1 2 3 4 
Arguments
x 
vector or matrix of quantiles. If 
n 
number of observations. 
delta 
the vector of noncentrality parameters of length n, for

sigma 
scale matrix, defaults to

df 
degrees of freedom. 
log 

type 
type of the noncentral multivariate t distribution.

... 
additional arguments to 
Details
If X denotes a random vector following a t distribution
with location vector 0 and scale matrix
Sigma (written X ~ t_nu(0,
Sigma)), the scale matrix (the argument
sigma
) is not equal to the covariance matrix Cov(X)
of X. If the degrees of freedom nu (the
argument df
) is larger than 2, then
Cov(X)=Sigma
nu/(nu2). Furthermore,
in this case the correlation matrix Cor(X) equals
the correlation matrix corresponding to the scale matrix
Sigma (which can be computed with
cov2cor()
). Note that the scale matrix is sometimes
referred to as “dispersion matrix”;
see McNeil, Frey, Embrechts (2005, p. 74).
For type = "shifted"
the density
c(1+(xδ)'S^{1}(xδ)/ν)^{(ν+m)/2}
is implemented, where
c = Γ((ν+m)/2)/((π ν)^{m/2}Γ(ν/2)S^{1/2}),
S is a positive definite symmetric matrix (the matrix
sigma
above), delta is the
noncentrality vector and nu are the degrees of freedom.
df=0
historically leads to the multivariate normal
distribution. From a mathematical point of view, rather
df=Inf
corresponds to the multivariate normal
distribution. This is (now) also allowed for rmvt()
and
dmvt()
.
Note that dmvt()
has default log = TRUE
, whereas
dmvnorm()
has default log = FALSE
.
References
McNeil, A. J., Frey, R., and Embrechts, P. (2005). Quantitative Risk Management: Concepts, Techniques, Tools. Princeton University Press.
See Also
pmvt()
and qmvt()
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34  ## basic evaluation
dmvt(x = c(0,0), sigma = diag(2))
## check behavior for df=0 and df=Inf
x < c(1.23, 4.56)
mu < 1:2
Sigma < diag(2)
x0 < dmvt(x, delta = mu, sigma = Sigma, df = 0) # default log = TRUE!
x8 < dmvt(x, delta = mu, sigma = Sigma, df = Inf) # default log = TRUE!
xn < dmvnorm(x, mean = mu, sigma = Sigma, log = TRUE)
stopifnot(identical(x0, x8), identical(x0, xn))
## X ~ t_3(0, diag(2))
x < rmvt(100, sigma = diag(2), df = 3) # t_3(0, diag(2)) sample
plot(x)
## X ~ t_3(mu, Sigma)
n < 1000
mu < 1:2
Sigma < matrix(c(4, 2, 2, 3), ncol=2)
set.seed(271)
x < rep(mu, each=n) + rmvt(n, sigma=Sigma, df=3)
plot(x)
## Note that the call rmvt(n, mean=mu, sigma=Sigma, df=3) does *not*
## give a valid sample from t_3(mu, Sigma)! [and thus throws an error]
try(rmvt(n, mean=mu, sigma=Sigma, df=3))
## df=Inf correctly samples from a multivariate normal distribution
set.seed(271)
x < rep(mu, each=n) + rmvt(n, sigma=Sigma, df=Inf)
set.seed(271)
x. < rmvnorm(n, mean=mu, sigma=Sigma)
stopifnot(identical(x, x.))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.