############################################################
### SIMULATED EXAMPLE 1
set.seed(899)
############################################################
I <- 21 # number of items
b <- seq(-2,2, len=I) # item difficulties
n <- 2000 # number of students
# simulate theta and covariates
theta <- rnorm( n )
x <- .7 * theta + rnorm( n , .5 )
y <- .2 * x+ .3*theta + rnorm( n , .4 )
dfr <- data.frame( theta , 1 , x , y )
# simulate Rasch model
dat1 <- sim.raschtype( theta = theta , b = b )
# Plausible value draws
pv1 <- plausible.value.imputation.raschtype(data=dat1 , X=dfr[,-1] , b = b ,
nplausible=3 , iter=10 , burnin=5)
# estimate linear regression based on first plausible value
mod1 <- lm( pv1$pvdraws[,1] ~ x+y )
summary(mod1)
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.27755 0.02121 -13.09 <2e-16 ***
## x 0.40483 0.01640 24.69 <2e-16 ***
## y 0.20307 0.01822 11.15 <2e-16 ***
Run the code above in your browser using DataLab