rmtd {mstudentd}R Documentation

Simulate from a Multivariate t Distribution

Description

Produces one or more samples from the multivariate (p variables) t distribution (MTD) with degrees of freedom nu, mean vector mu and correlation matrix Sigma.

Usage

rmtd(n, nu, mu, Sigma, tol = 1e-6)

Arguments

n

integer. Number of observations.

nu

numeric. The degrees of freedom.

mu

length p numeric vector. The mean vector

Sigma

symmetric, positive-definite square matrix of order p. The correlation matrix.

tol

tolerance for numerical lack of positive-definiteness in Sigma (for mvrnorm, see Details).

Details

A sample from a MTD with parameters \nu, \boldsymbol{\mu} and \Sigma can be generated using:

\displaystyle{X = \mu + \frac{Y}{\sqrt{\frac{u}{\nu}}}}

where Y is a random vector distributed among a centered Gaussian density with covariance matrix \Sigma (generated using mvrnorm) and u is distributed among a Chi-squared distribution with \nu degrees of freedom.

Value

A matrix with p columns and n rows.

Author(s)

Pierre Santagostini, Nizar Bouhlel

References

S. Kotz and Saralees Nadarajah (2004), Multivariate t Distributions and Their Applications, Cambridge University Press.

See Also

dmtd: probability density of a MTD.

Examples

nu <- 3
mu <- c(0, 1, 4)
Sigma <- matrix(c(1, 0.6, 0.2, 0.6, 1, 0.3, 0.2, 0.3, 1), nrow = 3)
x <- rmtd(10000, nu, mu, Sigma)
head(x)
dim(x)
mu; colMeans(x)
nu/(nu-2)*Sigma; var(x)


[Package mstudentd version 1.1.1 Index]