Examine parameter recovery and performance using simulated data through parallelization
sim_test(icondition, stan = TRUE, sem = TRUE, seed = 20220415)
integer indicating the iteration of simulation condition
boolean indicating whether estimation results should be compared with thurstonianIRT stan
boolean indicating whether estimation results should be compared with thurstonianIRT lavaan and mplus
random seed
save a timestamped RData file in the current working directory
if (FALSE) {
# load parallel package
library(parallel)
# Simulation conditions
n_person <- 2
n_item <- 4
n_neg <- 1
n_block <- 5
n_dim <- c(4, 6)
n_iter <- 100
n_burnin <- 20
step_size_sd <- 0.1
condition_mat <- expand.grid(n_person = n_person,
n_item = n_item,
n_neg = n_neg,
n_block = n_block,
n_dim = n_dim,
n_iter = n_iter,
n_burnin = n_burnin,
step_size_sd = step_size_sd)
n_condition <- nrow(condition_mat)
# create clusters
n_core <- detectCores()
cl <- makeCluster(n_core)
RNGkind("L'Ecuyer-CMRG")
# load libraries in clusters
clusterEvalQ(cl, library(thirt))
clusterExport(cl, "condition_mat")
# simulation tests
parLapply(cl, 1:n_condition, sim_test)
# stop cluster
stopCluster(cl)
}