This function samples n x muti-dimensional normal random matrix.
Usage
sim_mnormal(
num_sim,
mu = rep(0, 5),
sig = diag(5),
method = c("eigen", "chol")
)
Arguments
- num_sim
Number to generate process
- mu
Mean vector
- sig
Variance matrix
- method
Method to compute \(\Sigma^{1/2}\).
Choose between eigen
(spectral decomposition) and chol
(cholesky decomposition).
By default, eigen
.
Details
Consider \(x_1, \ldots, x_n \sim N_m (\mu, \Sigma)\).
Lower triangular Cholesky decomposition: \(\Sigma = L L^T\)
Standard normal generation: \(Z_{i1}, Z_{in} \stackrel{iid}{\sim} N(0, 1)\)
\(Z_i = (Z_{i1}, \ldots, Z_{in})^T\)
\(X_i = L Z_i + \mu\)