if (FALSE) {
# check the format of the data
# Entry 0 is not allowed
head(sim10MCDINA$simdat)
#---------------------------------
# check the format of the Q-matrix
#---------------------------------
# Take item 1 as an example:
# category 2 has a q-vector (1,0,0)
# category 1 has a q-vector (0,1,0)
# category 4 has a q-vector (1,1,0)
# category 3 is not included in the Q-matrix because it is not coded
# the order of the coded categories in the Q-matrix doesn't matter
sim10MCDINA$simQ
# Item coded cat A1 A2 A3
# 1 2 1 0 0
# 1 1 0 1 0
# 1 4 1 1 0
#...
est <- MCmodel(sim10MCDINA$simdat,sim10MCDINA$simQ)
est
est$testfit
#--------------------------------------
# Distractors involving more attributes
#--------------------------------------
# some distractors may involve attributes that are not invovled by the key option
# this is not allowed by the "original" MC-DINA (de la Torre, 2009) but is allowed
# in the current implementation
# Users need to specify the key for each item to appropriate handle such an issue
# Note item 1 below: category 1 is the key (as indicated in the key argument below)
# The distractor (category 4) involves an attribute not included by the key option
Qc <- matrix(c(1, 1, 1, 1, 0,
1, 2, 0, 1, 0,
1, 3, 1, 0, 0,
1, 4, 1, 0, 1,
2, 1, 1, 0, 0,
2, 3, 1, 1, 0,
2, 2, 1, 1, 1,
3, 4, 1, 1, 1,
3, 2, 1, 1, 0,
3, 3, 0, 1, 1,
4, 1, 0, 1, 1,
4, 2, 0, 0, 1,
5, 1, 1, 0, 0,
6, 3, 0, 1, 0,
7, 2, 0, 0, 1,
8, 4, 1, 0, 0,
9, 1, 0, 1, 0,
10, 4, 0, 0, 1),ncol = 5,byrow = TRUE)
est2 <- MCmodel(sim10MCDINA2$simdat,Qc, key = c(1,2,4,1,1,3,2,4,1,4))
est2
est2$prob.parm
est2$testfit
est2$attribute
}
Run the code above in your browser using DataLab