## data on party preferences in Germany
## (omit single observation with education = 1)
data("GermanParties2009", package = "psychotools")
gp <- subset(GermanParties2009, education != "1")
gp$education <- factor(gp$education)
## fit Bradley-Terry mixture, see ?btmix for more details
## and a fully-worked example
set.seed(2)
cm4 <- btmix(preference ~ gender + education + age + crisis, data = gp, k = 4, nrep = 1)
## inspect mixture and effects
library("lattice")
xyplot(cm4)
effectsplot(cm4)
## effect of education
eff4 <- allEffects(cm4)
effectsplot(eff4, selection = "education")Run the code above in your browser using DataLab