rmtd {mstudentd} | R Documentation |
Simulate from a Multivariate
Distribution
Description
Produces one or more samples from the multivariate ( variables)
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 |
Sigma |
symmetric, positive-definite square matrix of order |
tol |
tolerance for numerical lack of positive-definiteness in Sigma (for |
Details
A sample from a MTD with parameters ,
and
can be generated using:
where is a random vector distributed among a centered Gaussian density
with covariance matrix
(generated using
mvrnorm
)
and is distributed among a Chi-squared distribution with
degrees of freedom.
Value
A matrix with columns and
rows.
Author(s)
Pierre Santagostini, Nizar Bouhlel
References
S. Kotz and Saralees Nadarajah (2004), Multivariate 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)