simulate_d_sample {psychmeta} | R Documentation |
Simulate a sample of psychometric d value data with measurement error, direct range restriction, and/or indirect range restriction
Description
This function generates a simulated psychometric sample consisting of any number of groups and computes the d values that result after introducing measurement error and/or range restriction.
Usage
simulate_d_sample(
n_vec,
rho_mat_list,
mu_mat,
sigma_mat = 1,
rel_mat = 1,
sr_vec = 1,
k_items_vec = 1,
wt_mat = NULL,
sr_composites = NULL,
group_names = NULL,
var_names = NULL,
composite_names = NULL,
diffs_as_obs = FALSE
)
Arguments
n_vec |
Vector of sample sizes (or a vector of proportions, if parameters are to be estimated). |
rho_mat_list |
List of true-score correlation matrices. |
mu_mat |
Matrix of mean parameters, with groups on the rows and variables on the columns. |
sigma_mat |
Matrix of standard-deviation parameters, with groups on the rows and variables on the columns. |
rel_mat |
Matrix of reliability parameters, with groups on the rows and variables on the columns. |
sr_vec |
Vector of selection ratios. |
k_items_vec |
Number of test items comprising each of the variables to be simulated (all are single-item variables by default). |
wt_mat |
Optional matrix of weights to use in forming a composite of the variables in |
sr_composites |
Optional vector selection ratios for composite variables. If not |
group_names |
Optional vector of group names. |
var_names |
Optional vector of variable names. |
composite_names |
Optional vector of names for composite variables. |
diffs_as_obs |
Logical scalar that determines whether standard deviation parameters represent standard deviations of observed scores ( |
Value
A sample of simulated mean differences.
Examples
## Simulate statistics by providing integers as "n_vec":
simulate_d_sample(n_vec = c(200, 100), rho_mat_list = list(reshape_vec2mat(.5),
reshape_vec2mat(.4)),
mu_mat = rbind(c(1, .5), c(0, 0)), sigma_mat = rbind(c(1, 1), c(1, 1)),
rel_mat = rbind(c(.8, .7), c(.7, .7)), sr_vec = c(1, .5),
group_names = c("A", "B"))
## Simulate parameters by providing proportions as "n_vec":
simulate_d_sample(n_vec = c(2/3, 1/3), rho_mat_list = list(reshape_vec2mat(.5),
reshape_vec2mat(.4)),
mu_mat = rbind(c(1, .5), c(0, 0)), sigma_mat = rbind(c(1, 1), c(1, 1)),
rel_mat = rbind(c(.8, .7), c(.7, .7)), sr_vec = c(1, .5),
group_names = c("A", "B"))