# NOT RUN {
## Dichotomous models ##
# Generation of an item bank under 3PL with 100 items
m.3PL <- genDichoMatrix(100, model = "3PL")
m.3PL <- as.matrix(m.3PL)
# Creation of a response pattern (true ability level 0)
set.seed(1)
x <- genPattern(0, m.3PL)
# ML estimation
th <- thetaEst(m.3PL, x, method = "ML")
c(th, semTheta(th, m.3PL, method = "ML"))
# BM estimation, standard normal prior distribution
th <- thetaEst(m.3PL, x)
c(th, semTheta(th, m.3PL))
# BM estimation, uniform prior distribution upon range [-2,2]
th <- thetaEst(m.3PL, x, method = "BM", priorDist = "unif",
priorPar = c(-2, 2))
c(th, semTheta(th, m.3PL, method = "BM", priorDist = "unif",
priorPar = c(-2, 2)))
# BM estimation, Jeffreys' prior distribution
th <- thetaEst(m.3PL, x, method = "BM", priorDist = "Jeffreys")
c(th, semTheta(th, m.3PL, method = "BM", priorDist = "Jeffreys"))
# EAP estimation, standard normal prior distribution
th <- thetaEst(m.3PL, x, method = "EAP")
c(th, semTheta(th, m.3PL, x, method = "EAP"))
# EAP estimation, uniform prior distribution upon range [-2,2]
th <- thetaEst(m.3PL, x, method = "EAP", priorDist = "unif",
priorPar = c(-2, 2))
c(th, semTheta(th, m.3PL, x, method = "EAP", priorDist = "unif",
priorPar = c(-2, 2)))
# EAP estimation, Jeffreys' prior distribution
th <- thetaEst(m.3PL, x, method = "EAP", priorDist = "Jeffreys")
c(th, semTheta(th, m.3PL, x, method = "EAP", priorDist = "Jeffreys"))
# WL estimation
th <- thetaEst(m.3PL, x, method = "WL")
c(th, semTheta(th, m.3PL, method = "WL"))
# 'fixed4' adjustment for constant pattern
th <- thetaEst(m.3PL, rep(0, nrow(m.3PL)), constantPatt = "fixed4")
c(th, semTheta(th, m.3PL, constantPatt = "fixed4"))
# }
# NOT RUN {
## Polytomous models ##
# Generation of an item bank under GRM with 100 items and at most 4 categories
m.GRM <- genPolyMatrix(100, 4, "GRM")
m.GRM <- as.matrix(m.GRM)
# Creation of a response pattern (true ability level 0)
set.seed(1)
x <- genPattern(0, m.GRM, model = "GRM")
# ML estimation
th <- thetaEst(m.GRM, x, model = "GRM", method = "ML")
c(th, semTheta(th, m.GRM, model = "GRM", method = "ML"))
# BM estimation, standard normal prior distribution
th <- thetaEst(m.GRM, x, model = "GRM")
c(th, semTheta(th, m.GRM, model = "GRM"))
# BM estimation, uniform prior distribution upon range [-2,2]
th <- thetaEst(m.GRM, x, model = "GRM", method = "BM", priorDist = "unif",
priorPar = c(-2, 2))
c(th, semTheta(th, m.GRM, model = "GRM", method = "BM", priorDist = "unif",
priorPar = c(-2, 2)))
# BM estimation, Jeffreys' prior distribution
th <- thetaEst(m.GRM, x, model = "GRM", method = "BM", priorDist = "Jeffreys")
c(th, semTheta(th, m.GRM, model = "GRM", method = "BM", priorDist = "Jeffreys"))
# EAP estimation, standard normal prior distribution
th <- thetaEst(m.GRM, x, model = "GRM", method = "EAP")
c(th, semTheta(th, m.GRM, x, model = "GRM", method = "EAP") )
# EAP estimation, uniform prior distribution upon range [-2,2]
th <- thetaEst(m.GRM, x, model = "GRM", method = "EAP", priorDist = "unif",
priorPar = c(-2, 2))
c(th, semTheta(th, m.GRM, x, model = "GRM", method = "EAP", priorDist = "unif",
priorPar = c(-2, 2)))
# EAP estimation, Jeffreys' prior distribution
th <- thetaEst(m.GRM, x, model = "GRM", method = "EAP", priorDist = "Jeffreys")
c(th, semTheta(th, m.GRM, x, model = "GRM", method = "EAP", priorDist = "Jeffreys"))
# WL estimation
th <- thetaEst(m.GRM, x, model = "GRM", method = "WL")
c(th, semTheta(th, m.GRM, model = "GRM", method = "WL"))
# Generation of an item bank under PCM with 20 items and 4 categories
m.PCM <- genPolyMatrix(20, 4, "PCM", same.nrCat = TRUE)
m.PCM <- as.matrix(m.PCM)
# Creation of a response pattern (true ability level 0)
set.seed(1)
x <- genPattern(0, m.PCM, model = "PCM")
# ML estimation
th <- thetaEst(m.PCM, x, model = "PCM", method = "ML")
c(th, semTheta(th, m.PCM, model = "PCM", method = "ML"))
# BM estimation, standard normal prior distribution
th <- thetaEst(m.PCM, x, model = "PCM")
c(th, semTheta(th, m.PCM, model = "PCM"))
# BM estimation, uniform prior distribution upon range [-2,2]
th <- thetaEst(m.PCM, x, model = "PCM", method = "BM", priorDist = "unif",
priorPar = c(-2, 2))
c(th, semTheta(th, m.PCM, model = "PCM", method = "BM", priorDist = "unif",
priorPar = c(-2, 2)))
# BM estimation, Jeffreys' prior distribution
th <- thetaEst(m.PCM, x, model = "PCM", method = "BM", priorDist = "Jeffreys")
c(th, semTheta(th, m.PCM, model = "PCM", method = "BM", priorDist = "Jeffreys"))
# EAP estimation, standard normal prior distribution
th <- thetaEst(m.PCM, x, model = "PCM", method = "EAP")
c(th, semTheta(th, m.PCM, x, model = "PCM", method = "EAP"))
# EAP estimation, uniform prior distribution upon range [-2,2]
th <- thetaEst(m.PCM, x, model = "PCM", method = "EAP", priorDist = "unif",
priorPar = c(-2, 2))
c(th, semTheta(th, m.PCM, x, model = "PCM", method = "EAP", priorDist = "unif",
priorPar = c(-2, 2)))
# EAP estimation, Jeffreys' prior distribution
th <- thetaEst(m.PCM, x, model = "PCM", method = "EAP", priorDist = "Jeffreys")
c(th, semTheta(th, m.PCM, x, model = "PCM", method = "EAP", priorDist = "Jeffreys"))
# WL estimation
th <- thetaEst(m.PCM, x, model = "PCM", method = "WL")
c(th, semTheta(th, m.PCM, model = "PCM", method = "WL"))
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab