Description Usage Arguments Details Value References See Also Examples
Fit finite mixtures of Rasch models for item response data via conditional maximum likelihood with the EM algorithm.
1 2 3 4 5 6 7 8  raschmix(formula, data, k, subset, weights, scores = c("saturated", "meanvar"),
restricted = FALSE, nrep = 3, cluster = NULL, control = NULL, verbose = TRUE,
drop = TRUE, unique = FALSE, which = NULL, reltol = 1e10, deriv = "sum",
hessian = FALSE, restart = TRUE, model = NULL, gradtol = reltol, ...)
FLXMCrasch(formula = . ~ ., scores = "saturated", delta = NULL, nonExtremeProb = 1,
ref = 1, reltol = 1e10, deriv = "sum", hessian = FALSE,
restart = TRUE, ...)

formula 
Symbolic description of the model (of type 
data, subset 
Arguments controlling formula processing. 
k 
A vector of integers indicating the number of components of
the finite mixture; passed in turn to the 
weights 
An optional vector of weights to be used in the fitting
process; passed in turn to the 
scores 
Indicates which model should be fitted
for the score probabilities: either a 
restricted 
Logical. Should the score distributions be restricted to being equal across components? See Frick et al. (2015) for details. 
nrep 
Number of runs of the EM algorithm. 
cluster 
Either a matrix with 
control 
An object of class 
verbose 
A logical; if 
drop 
A logical; if 
unique 
A logical; if 
which 
number of model to get if 
nonExtremeProb 
A numeric giving the probability of scoring either none or all items. 
ref 
Reference category for the saturated score model. 
reltol, gradtol, deriv, hessian 
Control parameters passed to

restart 
Logical. Should the estimation of the item parameters be restarted in each iteration? If FALSE, the estimates from the previous Mstep are used as starting values. 
delta 
Parameters of score model. If 
model 
An object inheriting from class 
... 
Currently not used. 
raschmix
is intended as a convenience interface to the
stepFlexmix
function from the flexmix package
(Leisch 2004, Grün and Leisch 2008). The formula argument of
raschmix is used to describe the model in terms of both items and
concomitant variables, if any. On the lefthand side of the formula
the item are specified, either as a matrix y
or as single items
y1 + y2 + y3 + ...
. On the righthand side, the concomitant
variables are specified. If no concomitant variables are to be
included in the model, the righthand side of the is just written as
~ 1
. See Frick et al. (2012) for a detailed introduction.
raschmix
processes this model description and calls
stepFlexmix
with the suitable driver
FLXMCrasch
. Usually, the driver does not need to be called by
itself, but it is of course also possible to call
stepFlexmix
directly with this driver to fit
Rasch mixture models.
The Rasch mixture model with saturated score distribution as proposed by Rost (1990) is also known as “Mixed Rasch Model”. The meanvariance score distribution was suggested by Rost and von Davier (1995). A more recent extension is the restricted score specification by Frick et al. (2015) who also provide an extensive comparison using Monte Carlo studies.
Either an object of class "raschmix"
containing the best model
with respect to the loglikelihood (if k
is a scalar) or the
one selected according to which
(if specified and k
is a
vector of integers longer than 1) or an object of class
"stepRaschmix"
(if which
is not specified and k
is a
vector of integers longer than 1).
Frick, H., Strobl, C., Leisch, F., and Zeileis, A. (2012). Flexible Rasch Mixture Models with Package psychomix. Journal of Statistical Software, 48(7), 1–25. http://www.jstatsoft.org/v48/i07/.
Frick, H., Strobl, C., and Zeileis, A. (2015). Rasch Mixture Models for DIF Detection: A Comparison of Old and New Score Specifications. Educational and Psychological Measurement, 75(2), 208–234. doi:10.1177/0013164414536183.
Grün, B., and Leisch, F. (2008). FlexMix Version 2: Finite Mixtures with Concomitant Variables and Varying and Constant Parameters. Journal of Statistical Software, 28(4), 1–35. http://www.jstatsoft.org/v28/i04/.
Leisch, F. (2004). FlexMix: A General Framework for Finite Mixture Models and Latent Class Regression in R. Journal of Statistical Software, 11(8), 1–18. http://www.jstatsoft.org/v11/i08/.
Rost, J. (1990). Rasch Models in Latent Classes: An Integration of Two Approaches to Item Analysis. Applied Psychological Measurement, 14(3), 271–282.
Rost, J., and von Davier, M. (1995). Mixture Distribution Rasch Models. In Fischer, G.H., and Molenaar, I.W. (eds.), Rasch Models: Foundations, Recent Developments, and Applications, chapter 14, pp. 257–268. SpringerVerlag, New York.
flexmix
, stepFlexmix
,
simRaschmix
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128  ##########
## Data ##
##########
## simulate response from Rost's scenario 2 (with 2 latent classes)
suppressWarnings(RNGversion("3.5.0"))
set.seed(1)
r2 < simRaschmix(design = "rost2")
## plus informative and noninformative concomitants
d < data.frame(
x1 = rbinom(nrow(r2), prob = c(0.4, 0.6)[attr(r2, "cluster")], size = 1),
x2 = rnorm(nrow(r2))
)
d$resp < r2
## fit model with 2 latent classes (here the number is known a priori)
m < raschmix(r2, k = 2, scores = "saturated")
summary(m)
## see below for examples which do not use this a priori information
## (these take a little longer to compute)
####################################################
## Rasch mixture model with saturated score model ##
## (Rost, 1990) ##
####################################################
## fit models for k = 1, 2, 3
m1 < raschmix(r2, k = 1:3, score = "saturated")
## equivalently: m1 < raschmix(resp ~ 1, data = d, k = 1:3, score = "saturated")
## inspect results
m1
plot(m1)
## select best BIC model
BIC(m1)
m1b < getModel(m1, which = "BIC")
summary(m1b)
## compare estimated with true item parameters
parameters(m1b, "item") ## 9 items, item_1 = 0
worth(m1b) ## 10 items, sum = 0
attr(r2, "difficulty")
## graphical comparison
plot(m1b, pos = "top")
for(i in 1:2) lines(attr(r2, "difficulty")[,i], lty = 2, type = "b")
## extract estimated raw score probabilities
## (approximately equal across components and roughly uniform)
scoreProbs(m1b)
## note: parameters() and worth() take "component" argument
parameters(m1b, "item", component = 2)
parameters(m1b, "score", component = 1)
worth(m1b, component = 2:1)
## inspect posterior probabilities
histogram(m1b)
head(posterior(m1b)) ## for first observations only
## compare resulting clusters with true groups
table(model = clusters(m1b), true = attr(r2, "cluster"))
################################################################
## Rasch mixture model with mean/variance score distribution ##
## (Rost & von Davier, 1995) ##
################################################################
## more parsimonious parameterization,
## fit multinomial logit model for score probabilities
## fit models and select best BIC
m2 < raschmix(r2, k = 1:3, score = "meanvar")
plot(m2)
m2b < getModel(m2, which = "BIC")
## compare number of estimated parameters
dim(parameters(m2b))
dim(parameters(m1b))
## graphical comparison with true parameters
plot(m2b, pos = "top")
for(i in 1:2) lines(attr(r2, "difficulty")[,i], lty = 2, type = "b")
## results from nonparametric and parametric specification
## essentially identical
max(abs(worth(m1b)  worth(m2b, component = 2:1)))
###########################
## Concomitant variables ##
###########################
## employ concomitant variables (x1 = informative, x2 = not)
## Not run:
## fit model
cm2 < raschmix(resp ~ x1 + x2, data = d, k = 2:3, score = "meanvar")
## BIC selection
rbind(m2 = BIC(m2), cm2 = c(NA, BIC(cm2)))
cm2b < getModel(cm2, which = "BIC")
## concomitant coefficients
parameters(cm2b, which = "concomitant")
## End(Not run)
##########
## Misc ##
##########
## note: number of clusters can either be chosen directly
## or directly selected via AIC (or BIC, ICL)
## Not run:
raschmix(r2, k = 2)
raschmix(r2, k = 1:3, which = "AIC")
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.