rmatrixit {matrixsampling}R Documentation

Matrix inverted-t sampler

Description

Samples the matrix inverted-t distribution.

Usage

rmatrixit(n, nu, M, U, V, checkSymmetry = TRUE, keep = TRUE)

Arguments

n

sample size, a positive integer

nu

degrees of freedom, any positive number or an integer strictly greater than 1-nrow(M)

M

mean matrix, without constraints

U

columns covariance matrix, a positive semidefinite matrix of order equal to nrow(M)

V

rows covariance matrix, a positive semidefinite matrix of order equal to ncol(M)

checkSymmetry

logical, whether to check the symmetry of U and V

keep

logical, whether to return an array with class keep

Value

A numeric three-dimensional array; simulations are stacked along the third dimension (see example).

Examples

nu <- 0
m <- 2
p <- 3
M <- matrix(1, m, p)
U <- toeplitz(m:1)
V <- toeplitz(p:1)
ITsims <- rmatrixit(10000, nu, M, U, V)
dim(ITsims) # 2 3 10000
apply(ITsims, 1:2, mean) # approximates M
vecITsims <- t(apply(ITsims, 3, function(X) c(t(X))))
round(cov(vecITsims),2) # approximates 1/(nu+m+p-1) * kronecker(U,V)

[Package matrixsampling version 2.0.0 Index]