simulate_matrix | R Documentation |
This function generates simulated sample matrices based on a population matrix and a sample size.
It uses the Wishart distribution (i.e., the multivariate \chi^{2}
distribution) to obtain data, rescales the data into the input metric, and can be standardized into a correlation matrix by setting as_cor
to TRUE
.
The function can produce a list of matrices for any number of samples.
simulate_matrix(sigma, n, k = 1, as_cor = FALSE)
sigma |
Population covariance matrix. May be standardized or unstandardized. |
n |
Sample size for simulated sample matrices. |
k |
Number of sample matrices to generate. |
as_cor |
Should the simulated matrices be standardized ( |
A list of simulated sample matrices.
## Define a hypothetical matrix:
sigma <- reshape_vec2mat(cov = .4, order = 5)
## Simualte a list of unstandardized covariance matrices:
simulate_matrix(sigma = sigma, n = 50, k = 10, as_cor = FALSE)
## Simualte a list of correlation matrices:
simulate_matrix(sigma = sigma, n = 50, k = 10, as_cor = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.