mStudent | R Documentation |
These functions provide the density and random number generation from the multivariate Student-t distribution.
dmt(x, mean = rep(0, nrow(Sigma)), Sigma = diag(length(mean)), eta = 0.25, log = FALSE)
rmt(n = 1, mean = rep(0, nrow(Sigma)), Sigma = diag(length(mean)), eta = 0.25)
x |
vector or matrix of data. |
n |
the number of samples requested. |
mean |
a vector giving the means of each variable |
Sigma |
a positive-definite covariance matrix |
eta |
shape parameter (must be in |
log |
logical; if TRUE, the logarithm of the density function is returned. |
A random vector \bold{X} = (X_1,\dots,X_p)^T
has a multivariate t distribution,
with a \bold{\mu}
mean vector, covariance matrix \bold{\Sigma}
, and 0 \leq \eta
< 1/2
shape parameter, if its density function is given by
f(\bold{x}) = K_p(\eta)|\bold{\Sigma}|^{-1/2}\left\{1 + c(\eta)(\bold{x} - \bold{\mu})^T
\bold{\Sigma}^{-1} (\bold{x} - \bold{\mu})\right\}^{-\frac{1}{2\eta}(1 + \eta p)}.
where
K_p(\eta) = \left(\frac{c(\eta)}{\pi}\right)^{p/2}\frac{\Gamma(\frac{1}{2\eta}(1 + \eta p))}
{\Gamma(\frac{1}{2\eta})},
with c(\eta)=\eta/(1 - 2\eta)
. This parameterization of the multivariate t distribution
is introduced mainly because \bold{\mu}
and \bold{\Sigma}
correspond to the mean vector
and covariance matrix, respectively.
The function rmt
is an interface to C routines, which make calls to subroutines from LAPACK.
The matrix decomposition is internally done using the Cholesky decomposition. If Sigma
is not
non-negative definite then there will be a warning message.
This parameterization of the multivariate-t includes the normal distribution as a particular
case when eta = 0
.
If x
is a matrix with n
rows, then dmt
returns a n\times 1
vector considering each row of x
as a copy from the multivariate t distribution.
If n = 1
, then rmt
returns a vector of the same length as mean
, otherwise
a matrix of n
rows of random vectors.
Fang, K.T., Kotz, S., Ng, K.W. (1990). Symmetric Multivariate and Related Distributions. Chapman & Hall, London.
Gomez, E., Gomez-Villegas, M.A., Marin, J.M. (1998). A multivariate generalization of the power exponential family of distributions. Communications in Statistics - Theory and Methods 27, 589-600.
# covariance matrix
Sigma <- matrix(c(10,3,3,2), ncol = 2)
Sigma
# generate the sample
y <- rmt(n = 1000, Sigma = Sigma)
# scatterplot of a random bivariate t sample with mean vector
# zero and covariance matrix 'Sigma'
par(pty = "s")
plot(y, xlab = "", ylab = "")
title("bivariate t sample (eta = 0.25)", font.main = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.