MVT function

Multivariate Student t distribution

Multivariate Student t distribution

Density and random generation for the multivariate Student t distribution with location equal to mu, precision matrix equal to Q (or scale matrix equal to Sigma).

Mentioned functions implement the multivariate Student t distribution with a density given by [REMOVE_ME] %p(\boldsymbol{z}) =\frac{\Gamma\bigl(\frac{\nu+p}{2}\bigr)}{\Gamma\bigl(\frac{\nu}{2}\bigr)\,\nu^{\frac{p}{2}}\,\pi^{\frac{p}{2}}}\,\bigl|\Sigma\bigr|^{-\frac{1}{2}}\,\Bigl\{1 + \frac{(\boldsymbol{z} -\boldsymbol{\mu})'\Sigma^{-1}(\boldsymbol{z} -\boldsymbol{\mu})}{\nu}\Bigr\}^{-\frac{\nu+p}{2}},%p(z) = (Gamma((nu+p)/2)/(Gamma(nu/2) * nu^(p/2) * pi^(p/2))) *|Sigma|^(-1/2) * (1 + ((z - mu)'*Sigma^(-1)*(z - mu)) / nu)^(-(nu+p)/2), [REMOVE_ME_2]

where pp is the dimension, nu>0nu > 0 degrees of freedom, mumu the location parameter and SigmaSigma the scale matrix.

For nu>1nu > 1, the mean in equal to mumu, for nu>2nu > 2, the covariance matrix is equal to (nu/(nu2))Sigma(nu / (nu - 2)) * Sigma.

Description

Density and random generation for the multivariate Student t distribution with location equal to mu, precision matrix equal to Q (or scale matrix equal to Sigma).

Mentioned functions implement the multivariate Student t distribution with a density given by

%p(\boldsymbol{z}) =\frac{\Gamma\bigl(\frac{\nu+p}{2}\bigr)}{\Gamma\bigl(\frac{\nu}{2}\bigr)\,\nu^{\frac{p}{2}}\,\pi^{\frac{p}{2}}}\,\bigl|\Sigma\bigr|^{-\frac{1}{2}}\,\Bigl\{1 + \frac{(\boldsymbol{z} -\boldsymbol{\mu})'\Sigma^{-1}(\boldsymbol{z} -\boldsymbol{\mu})}{\nu}\Bigr\}^{-\frac{\nu+p}{2}},%p(z) = (Gamma((nu+p)/2)/(Gamma(nu/2) * nu^(p/2) * pi^(p/2))) *|Sigma|^(-1/2) * (1 + ((z - mu)'*Sigma^(-1)*(z - mu)) / nu)^(-(nu+p)/2),

where pp is the dimension, nu>0nu > 0 degrees of freedom, mumu the location parameter and SigmaSigma the scale matrix.

For nu>1nu > 1, the mean in equal to mumu, for nu>2nu > 2, the covariance matrix is equal to (nu/(nu2))Sigma(nu / (nu - 2)) * Sigma.

dMVT(x, df, mu=0, Q=1, Sigma, log=FALSE) rMVT(n, df, mu=0, Q=1, Sigma)

Arguments

  • df: degrees of freedom of the multivariate Student t distribution.
  • mu: vector of the location parameter.
  • Q: precision (inverted scale) matrix of the multivariate Student t distribution. Ignored if Sigma is given.
  • Sigma: scale matrix of the multivariate Student t distribution. If Sigma is supplied, precision is computed from SigmaSigma as Q=Sigma1Q = Sigma^{-1}.
  • n: number of observations to be sampled.
  • x: vector or matrix of the points where the density should be evaluated.
  • log: logical; if TRUE, log-density is computed

Returns

Some objects.

Value for dMVT

A vector with evaluated values of the (log-)density

Value for rMVT

A list with the components:

  • x: vector or matrix with sampled values
  • log.dens: vector with the values of the log-density evaluated in the sampled values

See Also

dt, Mvt.

Author(s)

Arnošt Komárek arnost.komarek@mff.cuni.cz

Examples

set.seed(1977) ### Univariate central t distribution z <- rMVT(10, df=1, mu=0, Q=1) ldz <- dMVT(z$x, df=1, log=TRUE) boxplot(as.numeric(z$x)) cbind(z$log.dens, ldz, dt(as.numeric(z$x), df=1, log=TRUE)) ### Multivariate t distribution mu <- c(1, 2, 3) Sigma <- matrix(c(1, 1, -1.5, 1, 4, 1.8, -1.5, 1.8, 9), nrow=3) Q <- chol2inv(chol(Sigma)) nu <- 3 z <- rMVT(1000, df=nu, mu=mu, Sigma=Sigma) apply(z$x, 2, mean) ## should be close to mu ((nu - 2) / nu) * var(z$x) ## should be close to Sigma dz <- dMVT(z$x, df=nu, mu=mu, Sigma=Sigma) ldz <- dMVT(z$x, df=nu, mu=mu, Sigma=Sigma, log=TRUE) ### Compare with mvtnorm package #require(mvtnorm) #ldz2 <- dmvt(z$x, sigma=Sigma, df=nu, delta=mu, log=TRUE) #plot(z$log.dens, ldz2, pch=21, col="red3", bg="orange", xlab="mixAK", ylab="mvtnorm") #plot(ldz, ldz2, pch=21, col="red3", bg="orange", xlab="mixAK", ylab="mvtnorm")