Learn R Programming

psychomix (version 0.2-1)

btmix: Finite Mixtures of Bradley-Terry Models

Description

Fit finte mixtures of Bradley-Terry models for paired comparisons data via maximum likelihood with the EM algorithm.

Usage

btmix(formula, data, k, subset, weights,
         nrep = 3, cluster = NULL, control = NULL,
         verbose = TRUE, drop = TRUE, unique = FALSE, which = NULL,
         type = c("loglin", "logit"), ref = NULL, undecided = NULL,
         position = NULL, ...)

FLXMCbtreg(formula = . ~ ., type = c("loglin", "logit"), ref = NULL, undecided = NULL, position = NULL, ...)

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.
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. Default is rando
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.
type
Character. Should an auxiliary log-linear Poisson model or logistic binomial be employed for estimation? The latter is only available if not undecided effects are estimated.
ref
Character or numeric. Which object parameter should be the reference category, i.e., constrained to zero?
undecided
Logical. Should an undecided parameter be estimated?
position
Logical. Should a position effect be estimated?
...
Currently not used.

Value

  • Either an object of class "btmix" 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 "stepBTmix" (if which is not specified and k is a vector of integers longer than 1).

encoding

latin1

Details

Internally stepFlexmix is called with suitable arguments to fit the finite mixture model with the EM algorithm.

FLXMCbtreg is the flexmix-driver for Bradley-Terry mixture models. This has not yet been fully tested and may change in future versions.

References

Bradley, R.A., and Terry, M.E. (1952). Rank Analysis of Incomplete Block Designs. I. The Method of Paired Comparisons. Biometrika, 39(3/4), 324--345. D�rr, M. (2011). Bradley Terry Mixture Models: Theory, Implementation in R and Validation. Diploma Thesis, Ludwig-Maximilians-Universit�t M�nchen. 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/.

See Also

flexmix, stepFlexmix

Examples

Run this code
##########
## Data ##
##########

data("GermanParties2009", package = "psychotools")

## omit single observation with education = 1
gp <- subset(GermanParties2009, education != "1")
gp$education <- factor(gp$education)

##################################
## Bradley-Terry mixture models ##
##################################

set.seed(1)
## fit model for k = 1 without concomitant variables
cm1 <- btmix(preference ~ 1, data = gp, k = 1)

## fit models for k = 2, 3, 4, 5 with concomitant variables
cm <- btmix(preference ~ gender + education + age + crisis, data = gp,
    k = 2:5, nrep = 5)

## inspect results
plot(1:5, c(BIC(cm1), BIC(cm)), type = "b")

## select model
cm4 <- getModel(cm, which = "4")

## inspect mixture and effects
xyplot(cm4)
effectsplot(cm4)

## effect of education
eff4 <- allEffects(cm4)
effectsplot(eff4, selection = "education")

Run the code above in your browser using DataLab