simulate_matrix {psychmeta} | R Documentation |
Generate a list of simulated sample matrices sampled from the Wishart distribution
Description
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.
Usage
simulate_matrix(sigma, n, k = 1, as_cor = FALSE)
Arguments
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 ( |
Value
A list of simulated sample matrices.
Examples
## 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)
[Package psychmeta version 2.7.0 Index]