# \donttest{
## 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
suppressWarnings(RNGversion("3.5.0"))
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)
## vis effects package directly
if(require("effects")) {
eff4 <- allEffects(cm4)
plot(eff4)
}
# }
Run the code above in your browser using DataLab