randef {mirt} | R Documentation |
Stochastically compute random effects for MixedClass
objects with Metropolis-Hastings
samplers and averaging over the draws to obtain expected a posteriori predictions.
Returns a list of the estimated effects.
randef(x, ndraws = 1000, thin = 10, return.draws = FALSE)
x |
an estimated model object from the |
ndraws |
total number of draws to perform. Default is 1000 |
thin |
amount of thinning to apply. Default is to use every 10th draw |
return.draws |
logical; return a list containing the thinned draws of the posterior? |
Phil Chalmers rphilip.chalmers@gmail.com
Chalmers, R., P. (2012). mirt: A Multidimensional Item Response Theory Package for the R Environment. Journal of Statistical Software, 48(6), 1-29.
Chalmers, R. P. (2015). Extended Mixed-Effects Item Response Models with the MH-RM Algorithm. Journal of Educational Measurement, 52, 200-222. doi:10.1111/jedm.12072 doi:10.18637/jss.v048.i06
## No test:
# make an arbitrary groups
covdat <- data.frame(group = rep(paste0('group', 1:49), each=nrow(Science)/49))
# partial credit model
mod <- mixedmirt(Science, covdat, model=1, random = ~ 1|group)
summary(mod)
##
## Call:
## mixedmirt(data = Science, covdata = covdat, model = 1, random = ~1 |
## group)
##
##
## --------------
## RANDOM EFFECT COVARIANCE(S):
## Correlations on upper diagonal
##
## $Theta
## F1
## F1 0.95
##
## $group
## COV_group
## COV_group 0.0185
effects <- randef(mod, ndraws = 2000, thin = 20)
head(effects$Theta)
## F1
## [1,] 0.56103080
## [2,] 0.16706616
## [3,] -0.54698853
## [4,] -0.69354830
## [5,] 0.09382988
## [6,] 0.84849861
head(effects$group)
## group
## group1 -0.0225108682
## group2 -0.0004085694
## group3 -0.0513209833
## group4 -0.0477643646
## group5 -0.0411090474
## group6 0.0207657189
## End(No test)