#############################################################################
# EXAMPLE 1: Processing rating data
#############################################################################
data(data.immer01a, package="immer")
dat <- data.immer01a
res <- immer::immer_proc_data( dat=dat[,paste0("k",1:5)], pid=dat$idstud,
rater=dat$rater)
str(res, max.level=1)
if (FALSE) {
#############################################################################
# EXAMPLE 2: Creating several design matrices for rating data
#############################################################################
data(data.ratings1, package="sirt")
dat <- data.ratings1
resp <- dat[,-c(1,2)]
#- redefine the second and third item such that the maximum category score is 2
for (vv in c(2,3)){
resp[ resp[,vv] >=2,vv ] <- 2
}
#--- process data
res0 <- immer::immer_proc_data( dat=resp, pid=dat$idstud, rater=dat$rater)
#--- rating scale model
des1 <- immer::immer_create_design_matrix_formula( itemtable=res0$itemtable,
formulaA=~ item + step )
des1$des
#--- partial scale model
des2 <- immer::immer_create_design_matrix_formula( itemtable=res0$itemtable,
formulaA=~ item + item:step )
des2$des
#--- multi-facets Rasch model
des3 <- immer::immer_create_design_matrix_formula( itemtable=res0$itemtable,
formulaA=~ item + item:step + rater )
des3$des
#--- polytomous model with quadratic step effects
des4 <- immer::immer_create_design_matrix_formula( itemtable=res0$itemtable,
formulaA=~ item + item:I(step_num^2) )
des4$des
}
Run the code above in your browser using DataLab