## Simulate 60 items loading on different Big Five dimensions,
## with different mean and item difficulty
item_dims <- sample(c("Openness","Conscientiousness","Neuroticism",
"Extraversion","Agreeableness"), 60, replace = TRUE)
item_mean <- rnorm(60, 5, 2)
item_difficulty <- runif(60, -1, 1)
## Construct data frame for item characteristics and produce
## 20 random triplet blocks with these 60 items
item_df <- data.frame(Dimensions = item_dims, Mean = item_mean,
Difficulty = item_difficulty)
solution <- make_random_block(60, 60, 3)
## Simple simulation of responses from 600 participants on the 60 items.
## In practice, should use real world data or simluation based on IRT parameters.
item_responses <- matrix(sample(seq(1:5), 600*60, replace = TRUE), ncol = 60, byrow = TRUE)
cal_block_energy_with_iia(solution, item_chars = item_df, weights = c(1,1,1),
FUN = c("facfun", "var", "var"),
rater_chars = item_responses, iia_weights = c(1,1,1,1))
Run the code above in your browser using DataLab