Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

pudding

Paired Comparisons of Chocolate Pudding


Description

This is an example dataset from Davidson 1970 comprising paired comparisons of chocolate pudding, with six brands in total. The responses include tied outcomes, i.e. no preference.

Usage

pudding

Format

A data frame with 15 records and 6 variables:

i

The first brand in the comparison.

j

The second brand in the comparison.

r_ij

The frequency of paired comparisons of brand i and brand j.

w_ij

The frequency of preferences for i over j.

w_ji

The frequency of preferences for j over i.

t_ij

The frequency of no preference between i and j.

References

Davidson, R. R. (1970). On extending the Bradley-Terry model to accommodate ties in paired comparison experiments. Journal of the American Statistical Association, 65, 317–328.

Examples

# create orderings for each set of paired comparisons

# wins for brand i and wins for brand j
i_wins <- data.frame(Winner = pudding$i, Loser = pudding$j)
j_wins <- data.frame(Winner = pudding$j, Loser = pudding$i)

# ties: use an array list (easier with R >= 3.6.0)
if (getRversion() < "3.6.0"){
  n <- nrow(pudding)
  ties <- data.frame(Winner = array(split(pudding[c("i", "j")], 1:n), n),
                     Loser = rep(NA, 15))
} else {
  ties <- data.frame(Winner = asplit(pudding[c("i", "j")], 1),
                     Loser = rep(NA, 15))
}
head(ties, 2)

# convert to rankings
R <- as.rankings(rbind(i_wins, j_wins, ties),
                 input = "orderings")
head(R, 2)
tail(R, 2)

# define weights as frequencies of each ranking
w <- unlist(pudding[c("w_ij", "w_ji", "t_ij")])

# fit Plackett-Luce model: limit iterations to match paper
mod <- PlackettLuce(R, npseudo = 0, weights = w, maxit = 7)

PlackettLuce

Plackett-Luce Models for Rankings

v0.4.0
GPL-3
Authors
Heather Turner [aut, cre] (<https://orcid.org/0000-0002-1256-3375>), Ioannis Kosmidis [aut] (<https://orcid.org/0000-0003-1556-0302>), David Firth [aut] (<https://orcid.org/0000-0003-0302-2312>), Jacob van Etten [ctb] (<https://orcid.org/0000-0001-7554-2558>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.