rmatnorm {robustmatrix}R Documentation

Simulate from a Matrix Normal Distribution

Description

Simulate from a Matrix Normal Distribution

Usage

rmatnorm(n, mu = NULL, cov_row, cov_col)

Arguments

n

the number of samples required.

mu

a p \times q matrix containing the means.

cov_row

a p \times p positive-definite symmetric matrix specifying the rowwise covariance matrix

cov_col

a q \times q positive-definite symmetric matrix specifying the columnwise covariance matrix

Value

If n = 1 a matrix with p rows and q columns, o otherwise a 3d array of dimensions (p,q,n) with a sample in each slice.

Examples

n = 1000; p = 2; q = 3
mu = matrix(rep(0, p*q), nrow = p, ncol = q)
cov_row = matrix(c(5,2,2,4), nrow = p, ncol = p)
cov_col = matrix(c(3,2,1,2,3,2,1,2,3), nrow = q, ncol = q)
X <- rmatnorm(n = 1000, mu, cov_row, cov_col)
X[,,9] #printing the 9th sample.

[Package robustmatrix version 0.1.2 Index]