if (FALSE) {
#############################################################################
# EXAMPLE 1: Latent regression for Rasch model with simulated data
#############################################################################
library(sirt)
#-- simulate data
set.seed(9877)
I <- 15 # number of items
N <- 700 # number of persons per group
G <- 3 # number of groups
b <- seq(-2,2,len=I)
group <- rep( 1:G, each=N)
mu <- seq(0,1, length=G)
sigma <- seq(1, 1.5, length=G)
dat <- sirt::sim.raschtype( stats::rnorm( N*G, mean=mu[group], sd=sigma[group] ), b)
#-- estimate Rasch model with JML
mod1 <- immer::immer_jml( dat )
summary(mod1)
#-- compute individual likelihood
like1 <- IRT.likelihood(mod1)
#-- estimate latent regression
mod2 <- immer::immer_latent_regression( like=like1, group=group)
summary(mod2)
}
Run the code above in your browser using DataLab