# NOT RUN {
# Generate item and examinee profiles
natt <- 3
nitem <- 4
nperson <- 5
Q <- rbind(c(1, 0, 0), c(0, 1, 0), c(0, 0, 1), c(1, 1, 1))
alpha <- rbind(c(0, 0, 0), c(1, 0, 0), c(0, 1, 0), c(0, 0, 1), c(1, 1, 1))
# Generate DINA model-based response data
slip <- c(0.1, 0.15, 0.2, 0.25)
guess <- c(0.1, 0.15, 0.2, 0.25)
my.par <- list(slip=slip, guess=guess)
data <- matrix(NA, nperson, nitem)
eta <- matrix(NA, nperson, nitem)
for (i in 1:nperson) {
for (j in 1:nitem) {
eta[i, j] <- prod(alpha[i,] ^ Q[j, ])
P <- (1 - slip[j]) ^ eta[i, j] * guess[j] ^ (1 - eta[i, j])
u <- runif(1)
data[i, j] <- as.numeric(u < P)
}
}
# Using the function to estimate item parameters
parMLE.result <- ParMLE(data, Q, alpha, model="DINA")
print(parMLE.result) # Print the estimated item parameters and standard errors
ItemFit(parMLE.result)
ModelFit(parMLE.result)
# }
Run the code above in your browser using DataLab