
Draw multiple samples from a matrix-normal distribution (Cholesky parameterisation)
Source:R/func_gen_data.R
rmn_chol_more.RdDraws nsam independent samples from \(MN(m, U, \Sigma)\) using
the Cholesky factors of \(U\) and \(\Sigma\).
Examples
set.seed(1)
U <- matrix(c(1, 0.5, 0.5, 1), 2)
Sigma <- diag(c(1, 2, 3))
draws <- rmn_chol_more(2000, m = matrix(0, 2, 3), RM = chol(U), RSigma = chol(Sigma))
dim(draws)
#> [1] 2 3 2000
var(draws[1, 3, ]) # close to U[1, 1] * Sigma[3, 3] = 3
#> [1] 2.933414
cor(draws[1, 1, ], draws[2, 1, ]) # close to U[1, 2] = 0.5
#> [1] 0.5231691