#############################################################################
# EXAMPLE 1: Mathematics data | Gender DIF
#############################################################################
data( data.math )
dat <- data.math$data
items <- grep( "M" , colnames(dat))
# estimate item parameters and WLEs
mod <- rasch.mml2( dat[,items] )
wle <- wle.rasch( dat[,items] , b=mod$item$b )$theta
# assess DIF by logistic regression
mod1 <- dif.logistic.regression( dat=dat[,items] , score=wle , group=dat$female)
# calculate DIF variance
dif1 <- dif.variance( dif=mod1$uniformDIF , se.dif = mod1$se.uniformDIF )
dif1$unweighted.DIFSD
## > dif1$unweighted.DIFSD
## [1] 0.1963958
# calculate stratified DIF variance
# stratification based on domains
dif2 <- dif.strata.variance( dif=mod1$uniformDIF , se.dif = mod1$se.uniformDIF ,
itemcluster = data.math$item$domain )
## $unweighted.DIFSD
## [1] 0.1455916
#****
# Likelihood ratio test and graphical model test in eRm package
library(eRm)
# estimate Rasch model
res <- eRm::RM( dat[,items] )
summary(res)
# LR-test with respect to female
lrres <- eRm::LRtest(res, splitcr = dat$female)
summary(lrres)
# graphical model test
eRm::plotGOF(lrres)
Run the code above in your browser using DataLab