btmix: Finite Mixtures of Bradley-Terry Models

Description Usage Arguments Details Value References See Also Examples

View source: R/btmix.R

Description

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

Usage

1
2
3
4
5
6
7
8
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 random assignment into k clusters.

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.

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.

The interface is designed along the same lines as raschmix which is introduced in detail in Frick et al. (2012). However, the btmix function has not yet been fully tested and may change in future versions.

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).

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.

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/.

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

 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
## 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
suppressWarnings(RNGversion("3.5.0"))
set.seed(1)
## fit models for k = 1, ..., 4 with concomitant variables
cm <- btmix(preference ~ gender + education + age + crisis,
  data = gp, k = 1:4, nrep = 3)

## inspect results
plot(cm)

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

## inspect mixture and effects
library("lattice")
xyplot(cm4)
effectsplot(cm4)
effectsplot(cm4, selection = "education")

## vis effects package directly
if(require("effects")) {
eff4 <- allEffects(cm4)
plot(eff4)
}

psychomix documentation built on Jan. 31, 2020, 1:06 a.m.