Learn R Programming

TFORGE (version 0.1.16)

rsymm_norm: Simulate Symmetric Matrices with Multivariate Normal Elements

Description

Simulate symmetric matrices with elements from a multivariate Normal distribution.

Usage

rsymm_norm(n, mean, sigma = diag(length(vech(mean))))

rsymm(n, mean, sigma = diag(length(vech(mean))))

Value

A set of flattened symmetric matrices as a TFORGE_fsm object. See as_fsm().

Arguments

n

Number of matrices to generate

mean

A symmetric matrix specifying the mean of the distribution.

sigma

A covariance matrix for the vectorised lower triangular elements (arranged by vech()) of the symmetric matrix. It is passed to mvtnorm::rmvnorm() without any transformation.

Details

The mean matrix is vectorised using the vech() function and then used as the mean vector in the mvtnorm::rmvnorm() function. The covariance matrix sigma is passed unchanged to mvtnorm::rmvnorm(). Symmetric matrices can be obtained by applying inv_vech() to each simulated vector.

Examples

Run this code
rsymm_norm(100, diag(c(3,2,1)))

Run the code above in your browser using DataLab