psychomix (version 1.1-8)

raschmix: Finite Mixtures of Rasch Models

Description

Fit finite mixtures of Rasch models for item response data via conditional maximum likelihood with the EM algorithm.

Usage

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 = 1e-10, deriv = "sum",
  hessian = FALSE, restart = TRUE, model = NULL, gradtol = reltol, …)

FLXMCrasch(formula = . ~ ., scores = "saturated", delta = NULL, nonExtremeProb = 1, ref = 1, reltol = 1e-10, deriv = "sum", hessian = FALSE, restart = TRUE, …)

Arguments

formula

Symbolic description of the model (of type y ~ 1 or y ~ x).

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 k argument of stepFlexmix.

weights

An optional vector of weights to be used in the fitting process; passed in turn to the weights argument of flexmix.

scores

Indicates which model should be fitted for the score probabilities: either a saturated model with a separate parameter for each score probability, or, for meanvar, a multinomial logit model with a location and a scale parameter.

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 k columns of initial cluster membership probabilities for each observation; or a factor or integer vector with the initial cluster assignments of observations at the start of the EM algorithm.

control

An object of class "FLXcontrol" or a named list; controls the EM algorithm and passed in turn to the control argument of flexmix.

verbose

A logical; if TRUE progress information is shown for different starts of the EM algorithm.

drop

A logical; if TRUE and k is of length 1, then a single raschmix object is returned instead of a stepRaschmix object.

unique

A logical; if TRUE, then unique() is called on the result; for details see stepFlexmix.

which

number of model to get if k is a vector of integers longer than one. If character, interpreted as number of components or name of an information criterion.

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 RaschModel.fit for the M-step. The gradtol argument is deprecated and reltol should be used instead.

restart

Logical. Should the estimation of the item parameters be restarted in each iteration? If FALSE, the estimates from the previous M-step are used as starting values.

delta

Parameters of score model. If NULL, a score model is estimated.

model

An object inheriting from class "FLXM" for the flexmix-driver, as typically produced by FLXMCrasch. By default FLXMCrasch is called automatically with the parameters computed from raschmix.

Currently not used.

Value

Either an object of class "raschmix" containing the best model with respect to the log-likelihood (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).

Details

raschmix is intended as a convenience interface to the stepFlexmix function from the flexmix package (Leisch 2004, Gr<U+2E821BA4> 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 left-hand side of the formula the item are specified, either as a matrix y or as single items y1 + y2 + y3 + …. On the right-hand side, the concomitant variables are specified. If no concomitant variables are to be included in the model, the right-hand 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 mean-variance 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.

References

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<U+2EB200AE>, 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. Springer-Verlag, New York.

See Also

flexmix, stepFlexmix, simRaschmix

Examples

Run this code
# NOT RUN {
##########
## 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 non-informative 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) 


# }
# NOT RUN {
####################################################
## 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"))
# }
# NOT RUN {

# }
# NOT RUN {
################################################################
##  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 non-parametric and parametric specification
## essentially identical
max(abs(worth(m1b) - worth(m2b, component = 2:1)))
# }
# NOT RUN {

###########################
## 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")
# }
# 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")
# }

Run the code above in your browser using DataCamp Workspace