#############################################################################
# SIMULATED 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( 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
library(TAM)
mod4 <- TAM::tam.jml2( resp=dat )
#******
# 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 )
mod4 <- rasch.jml( dat , constraints = constraints )
summary(mod4)
# For constrained item parameters, it this not obvious
# how to calculate a 'right correction' of item parameter bias
Run the code above in your browser using DataLab