dat <- expand.table(LSAT7)
mod <- mirt(dat, 1, 'Rasch')
(values <- mod2values(mod))
#test all slopes individually
parnum <- values$parnum[values$name == 'a1']
lagrange(mod, parnum)
# compare to LR test for first two slopes
mod2 <- mirt(dat, 'F = 1-5
FREE = (1, a1)', 'Rasch')
coef(mod2, simplify=TRUE)$items
anova(mod, mod2)
mod2 <- mirt(dat, 'F = 1-5
FREE = (2, a1)', 'Rasch')
coef(mod2, simplify=TRUE)$items
anova(mod, mod2)
# test slopes first two slopes and last three slopes jointly
lagrange(mod, list(parnum[1:2], parnum[3:5]))
# DIF test
set.seed(1234)
n <- 30
N <- 500
a <- matrix(1, n)
d <- matrix(rnorm(n), n)
group <- c(rep('Group_1', N), rep('Group_2', N))
# groups completely equal
dat1 <- simdata(a, d, N, itemtype = 'dich')
dat2 <- simdata(a, d, N, itemtype = 'dich')
dat <- rbind(dat1, dat2)
mod <- multipleGroup(dat, 1, group=group,
invariance=c('free_means', 'free_var', colnames(dat)))
coef(mod, simplify=TRUE)
values <- mod2values(mod)
# mirtCluster()
lagrange(mod, list(c(123, 124), c(239,240)))
Run the code above in your browser using DataLab