This function generates inter-item covariance matrices from a population matrix and computes a coefficient alpha reliability estimate for each matrix.
simulate_alpha(
item_mat = NULL,
alpha = NULL,
k_items = NULL,
n_cases,
k_samples,
standarized = FALSE
)
A vector of simulated sample alpha coefficients
Item correlation/covariance matrix. If item_mat is not supplied, the user must supply both alpha
and k_items
.
If item_mat is NULL
, the program will assume that all item intercorrelations are equal.
Population alpha value. Must be supplied if item_mat
is NULL
.
Number of items on the test to be simulated. Must be supplied if item_mat
is NULL.
Number of cases to simulate in sampling distribution of alpha.
Number of samples to simulate.
Should alpha be computed from correlation matrices (TRUE
) or unstandardized covariance matrices (FALSE
)?
## Define a hypothetical matrix:
item_mat <- reshape_vec2mat(cov = .3, order = 12)
## Simulations of unstandardized alphas
set.seed(100)
simulate_alpha(item_mat = item_mat, n_cases = 50, k_samples = 10, standarized = FALSE)
set.seed(100)
simulate_alpha(alpha = mean(item_mat[lower.tri(item_mat)]) / mean(item_mat),
k_items = ncol(item_mat), n_cases = 50, k_samples = 10, standarized = FALSE)
## Simulations of standardized alphas
set.seed(100)
simulate_alpha(item_mat = item_mat, n_cases = 50, k_samples = 10, standarized = TRUE)
set.seed(100)
simulate_alpha(alpha = mean(item_mat[lower.tri(item_mat)]) / mean(item_mat),
k_items = ncol(item_mat), n_cases = 50, k_samples = 10, standarized = TRUE)
Run the code above in your browser using DataLab