## Dichotomous models ##
# Loading the 'tcals' parameters
data(tcals)
# Selecting item parameters only
tcals <- as.matrix(tcals[,1:4])
# Creation of a response pattern (tcals item parameters, true ability level 0)
set.seed(1)
x <- genPattern(0, tcals)
# ML estimation
th <- thetaEst(tcals, x, method = "ML")
c(th, semTheta(th, tcals, method = "ML"))
# BM estimation, standard normal prior distribution
th <- thetaEst(tcals, x)
c(th, semTheta(th, tcals))
# BM estimation, uniform prior distribution upon range [-2,2]
th <- thetaEst(tcals, x, method = "BM", priorDist = "unif",
priorPar = c(-2, 2))
c(th, semTheta(th, tcals, method = "BM", priorDist = "unif",
priorPar = c(-2, 2)))
# BM estimation, Jeffreys' prior distribution
th <- thetaEst(tcals, x, method = "BM", priorDist = "Jeffreys")
c(th, semTheta(th, tcals, method = "BM", priorDist = "Jeffreys"))
# EAP estimation, standard normal prior distribution
th <- thetaEst(tcals, x, method = "EAP")
c(th, semTheta(th, tcals, x, method = "EAP"))
# EAP estimation, uniform prior distribution upon range [-2,2]
th <- thetaEst(tcals, x, method = "EAP", priorDist = "unif",
priorPar = c(-2, 2))
c(th, semTheta(th, tcals, x, method = "EAP", priorDist = "unif",
priorPar = c(-2, 2)))
# EAP estimation, Jeffreys' prior distribution
th <- thetaEst(tcals, x, method = "EAP", priorDist = "Jeffreys")
c(th, semTheta(th, tcals, x, method = "EAP", priorDist = "Jeffreys"))
# WL estimation
th <- thetaEst(tcals, x, method = "WL")
c(th, semTheta(th, tcals, method = "WL"))
## 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"))Run the code above in your browser using DataLab