#############################################################################
# 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 <- sirt::sim.raschtype( stats::rnorm( N, mean=.5 ), b )
colnames(dat) <- paste( "I", 1:I, sep="")
# JML estimation of the Rasch model (centering persons)
mod1 <- sirt::rasch.jml( dat )
summary(mod1)
# JML estimation of the Rasch model (centering items)
mod1b <- sirt::rasch.jml( dat, center="items" )
summary(mod1b)
# MML estimation with rasch.mml2 function
mod2 <- sirt::rasch.mml2( dat )
summary(mod2)
# Pairwise method of Fischer
mod3 <- sirt::rasch.pairwise( dat )
summary(mod3)
# JML estimation in TAM
if (FALSE) {
library(TAM)
mod4 <- TAM::tam.jml( 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 )
mod6 <- sirt::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
}
Run the code above in your browser using DataLab