R: Simulating multiple normal distribution with any given corr matrix
For example , we have a corr matrix for five standardized factors (Hau, Chinese Textbook, pp. 49-50).
m_corr=c(1, .42, .41, .55, .42);
m_corr=cbind(m_corr, c(.42, 1,.48, .47, .46));
m_corr=cbind(m_corr, c(.41, .48,1, .48, .44));
m_corr=cbind(m_corr, c(.55, .47,.48, 1, .50));
m_corr=cbind(m_corr, c(.42, .46,.44, .50, 1));
m_corr;
## show the original corr matrix
dp=svd(m_corr);
plot(dp$d,type=”o”); ## show the scree plot if there is a PC analysis
diag(dp$d); ## [...]