RcppArmadillo::armadillo_throttle_cores(1)
# extended example
# we:
# 1) define an mst design
# 2) simulate mst data
# 3) create a project, enter scoring rules and define the MST test
# 4) do an analysis
library(dplyr)
items = data.frame(item_id=sprintf("item%02i",1:70), item_score=1, delta=sort(runif(70,-1,1)))
design = data.frame(item_id=sprintf("item%02i",1:70),
module_id=rep(c('M4','M2','M5','M1','M6','M3', 'M7'),each=10))
routing_rules = routing_rules = mst_rules(
`124` = M1[0:5] --+ M2[0:10] --+ M4,
`125` = M1[0:5] --+ M2[11:15] --+ M5,
`136` = M1[6:10] --+ M3[6:15] --+ M6,
`137` = M1[6:10] --+ M3[16:20] --+ M7)
theta = rnorm(3000)
dat = sim_mst(items, theta, design, routing_rules,'all')
dat$test_id='sim_test'
dat$response=dat$item_score
scoring_rules = data.frame(
item_id = rep(items$item_id,2),
item_score= rep(0:1,each=nrow(items)),
response= rep(0:1,each=nrow(items))) # dummy respons
db = create_mst_project(":memory:")
add_scoring_rules_mst(db, scoring_rules)
create_mst_test(db,
test_design = design,
routing_rules = routing_rules,
test_id = 'sim_test',
routing = "all")
add_response_data_mst(db, dat)
design_plot(db)
f = fit_enorm_mst(db)
head(coef(f))
abl = ability(get_responses_mst(db), f) %>%
inner_join(tibble(person_id=as.character(1:3000), theta.sim=theta), by='person_id')
plot(abl$theta, abl$theta.sim)
abl = filter(abl, is.finite(theta))
cor(abl$theta, abl$theta.sim)
RcppArmadillo::armadillo_reset_cores()
Run the code above in your browser using DataLab