# generate an item pool
pool <- gen.irt(1, 200)$items
pool$content <- sample(1:3, nrow(pool), replace=TRUE)
# 1-2-3 design with 2 parallel panels
x <- mst(pool, c(1, 2, 3), 2)
# remove route with radical changes from the 1-3-3 design
x <- mst.route(x, c(1, 2, 6), "-", print=TRUE)
x <- mst.route(x, c(1, 3, 4), "-", print=TRUE)
# maximize information at -1.0/0/1.0 for low-/mid-/high-ability routes
x <- mst.objective(x, -1.0, Inf, routes=1)
x <- mst.objective(x, 0.0, Inf, routes=2:3)
x <- mst.objective(x, 1.0, Inf, routes=4)
# all routes to have 10 items
x <- mst.constraint(x, "len", NA, 10, 10)
x <- mst.constraint(x, "content", 1, 3, 3)
# all least 2 items each stage
x <- mst.stagelength(x, 1, 2, 10)
x <- mst.stagelength(x, 2, 2, 10)
x <- mst.stagelength(x, 3, 2, 10)
# assemble
x <- mst.assemble(x)
# check content
for(p in 1:x$npanel){
for(r in 1:x$nroute){
cat("Panel #", p, " Route #", r, ", Content Area 1 has ",
freq(mst.get(x, panel=p, route=r)$content, 1:3)$n[1], " items.\n", sep="")
}
}
# check TIFs
plot(x, by.route=TRUE)
# run simulation
mst.sim(x, 1.5)
mst.sim(x, 0.5)
mst.sim(x, -0.5)
mst.sim(x, -1.5)
# Solve a big problem in sequence
rm("x")
pool <- gen.irt(1, 1000)$items
pool$content <- sample(1:3, nrow(pool), replace=TRUE)
x <- mst(pool, c(1, 2, 3), 3)
x <- mst.route(x, c(1, 2, 6), "-")
x <- mst.route(x, c(1, 3, 4), "-")
x <- mst.objective(x, -1.0, Inf, routes=1)
x <- mst.objective(x, 0.0, Inf, routes=2:3)
x <- mst.objective(x, 1.0, Inf, routes=4)
x <- mst.constraint(x, "len", NA, 10, 10)
x <- mst.constraint(x, "content", 1, 3, 3)
x <- mst.stagelength(x, 1, 2, 10)
x <- mst.stagelength(x, 2, 2, 10)
x <- mst.stagelength(x, 3, 2, 10)
# unlikely to be solved simulatanouesly within 1 minute
# invisible(mst.assemble(x, timeout=60))
# may be solved in sequence within 1 minute
x <- mst.assemble.sequence(x, timeout=60)
plot(x, by.route=TRUE)
Run the code above in your browser using DataLab