rmatrixit: Matrix inverted-t sampler

Description Usage Arguments Value Examples

View source: R/student.R

Description

Samples the matrix inverted-t distribution.

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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)

matrixsampling documentation built on Aug. 25, 2019, 1:03 a.m.