# rmatrixnormal: Matrix normal sampler In matrixsampling: Simulations of Matrix Variate Distributions

## Description

Samples the matrix normal distribution.

## Usage

 `1` ```rmatrixnormal(n, M, U, V, checkSymmetry = TRUE, keep = TRUE) ```

## Arguments

 `n` sample size, a positive integer `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``` ```m <- 3 p <- 2 M <- matrix(1, m, p) U <- toeplitz(m:1) V <- toeplitz(p:1) MNsims <- rmatrixnormal(10000, M, U, V) dim(MNsims) # 3 2 10000 apply(MNsims, 1:2, mean) # approximates M vecMNsims <- t(apply(MNsims, 3, function(X) c(t(X)))) round(cov(vecMNsims)) # approximates kronecker(U,V) ```

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