#############################################################################
# EXAMPLE 1: Simulated data from the Rasch model
#############################################################################
set.seed(789)
N <- 500 # number of persons
I <- 11 # number of items
b <- seq( -2 , 2 , length=I )
dat <- sim.raschtype( stats::rnorm( N ) , b )
colnames(dat) <- paste( "I" , 1:I , sep="")
# JML estimation of the Rasch model
mod1 <- rasch.jml( dat )
summary(mod1)
# MML estimation with rasch.mml2 function
mod2 <- rasch.mml2( dat )
summary(mod2)
# Pairwise method of Fischer
mod3 <- rasch.pairwise( dat )
summary(mod3)
# JML estimation in TAM
## Not run:
# library(TAM)
# mod4 <- TAM::tam.jml2( resp=dat )
#
# # JML estimation in mixRasch package
# library(mixRasch)
# mod5 <- mixRasch::mixRasch( dat, steps=1, n.c=1, max.iter=50)
# print(mod5)
# mod5$item.par # extract item parameters
#
# #******
# # item parameter constraints in JML estimation
# # fix item difficulties: b[4]=-.76 and b[6]= .10
# constraints <- matrix( cbind( 4 , -.76 ,
# 6 , .10 ) ,
# ncol=2 , byrow=TRUE )
# mod6 <- rasch.jml( dat , constraints = constraints )
# summary(mod6)
# # For constrained item parameters, it this not obvious
# # how to calculate a 'right correction' of item parameter bias
# ## End(Not run)
Run the code above in your browser using DataLab