data(celebrities) # absolute choice frequencies
btl1 <- eba(celebrities) # fit a Bradley-Terry-Luce model
A <- list(c(1,10), c(2,10), c(3,10), c(4,11), c(5,11), c(6,11),
c(7,12), c(8,12), c(9,12)) # the structure of aspects
eba1 <- eba(celebrities, A) # fit a preference tree model
summary(eba1) # goodness of fit
plot(eba1) # residuals versus predicted values
anova(btl1, eba1) # model comparison based on likelihoods
ci <- 1.96 * sqrt(diag(cov.u(eba1))) # 95\% CI for preference scale values
a <- barplot(eba1$u, ylim = c(0, .35)) # plot the scale
arrows(a, eba1$u-ci, a, eba1$u+ci, .05, 90, 3) # error bars
Run the code above in your browser using DataLab