## 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)
# EAP estimation, standard normal prior distribution
th <- eapEst(tcals, x)
c(th, eapSem(th, tcals, x))
# EAP estimation, uniform prior distribution upon range [-2,2]
th <- eapEst(tcals, x, priorDist = "unif", priorPar = c(-2, 2))
c(th, eapSem(th, tcals, x, priorDist = "unif", priorPar=c(-2, 2)))
# EAP estimation, Jeffreys' prior distribution
th <- eapEst(tcals, x, priorDist = "Jeffreys")
c(th, eapSem(th, tcals, x, priorDist = "Jeffreys"))
## 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")
#
# # EAP estimation, standard normal prior distribution
# th <- eapEst(m.GRM, x, model = "GRM")
# c(th, eapSem(th, m.GRM, x, model = "GRM"))
#
# # EAP estimation, uniform prior distribution upon range [-2,2]
# th <- eapEst(m.GRM, x, model = "GRM", priorDist = "unif", priorPar = c(-2, 2))
# c(th, eapSem(th, m.GRM, x, model = "GRM", priorDist = "unif", priorPar = c(-2, 2)))
#
# # EAP estimation, Jeffreys' prior distribution
# th <- eapEst(m.GRM, x, model = "GRM", priorDist = "Jeffreys")
# c(th, eapSem(th, m.GRM, x, model = "GRM", priorDist = "Jeffreys"))
#
#
# # Generation of a item bank under PCM with 20 items and at most 3 categories
# m.PCM <- genPolyMatrix(20, 3, "PCM")
# 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")
#
# # EAP estimation, standard normal prior distribution
# th <- eapEst(m.PCM, x, model = "PCM")
# c(th, eapSem(th, m.PCM, x, model = "PCM"))
#
# # EAP estimation, uniform prior distribution upon range [-2,2]
# th <- eapEst(m.PCM, x, model = "PCM", priorDist = "unif", priorPar = c(-2, 2))
# c(th, eapSem(th, m.PCM, x, model = "PCM", priorDist = "unif", priorPar = c(-2, 2)))
#
# # EAP estimation, Jeffreys' prior distribution
# th <- eapEst(m.PCM, x, model = "PCM", priorDist = "Jeffreys")
# c(th, eapSem(th, m.PCM, x, model = "PCM", priorDist = "Jeffreys"))
# ## End(Not run)
Run the code above in your browser using DataLab