Skip to content

Commit 2e83f02

Browse files
committed
add refs to DESCRIPTION, correct Luce ref
1 parent 52c0ba8 commit 2e83f02

35 files changed

+416
-466
lines changed

DESCRIPTION

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ Authors@R: c(person("Heather", "Turner", email =
88
"Firth", role = "aut"), person("Jacob", "van Etten", role = "ctb"))
99
URL: https://hturner.github.io/PlackettLuce/
1010
BugReports: https://github.com/hturner/PlackettLuce/issues
11-
Description: Functions to prepare rankings data and fit the Plackett-Luce model.
12-
The standard Plackett-Luce model is generalized to accommodate ties of any
13-
order in the ranking. Partial rankings, in which only a subset of items are
14-
ranked in each ranking, are also accommodated in the implementation.
15-
Disconnected/weakly connected networks implied by the rankings are handled
16-
by adding pseudo-rankings with a hypothetical item. Methods are provided to
17-
estimate standard errors or quasi-standard errors for inference as well as
18-
to fit Plackett-Luce trees. See the package website or vignette for full
19-
details.
11+
Description: Functions to prepare rankings data and fit the Plackett-Luce model
12+
jointly attributed to Plackett (1975) <doi:10.2307/2346567> and Luce
13+
(1959, ISBN:0486441369). The standard Plackett-Luce model is generalized
14+
to accommodate ties of any order in the ranking. Partial rankings, in which
15+
only a subset of items are ranked in each ranking, are also accommodated in
16+
the implementation. Disconnected/weakly connected networks implied by the
17+
rankings are handled by adding pseudo-rankings with a hypothetical item.
18+
Methods are provided to estimate standard errors or quasi-standard errors
19+
for inference as well as to fit Plackett-Luce trees. See the package website
20+
or vignette for full details.
2021
License: GPL-3
2122
Encoding: UTF-8
2223
LazyData: true

README.md

Lines changed: 114 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,50 @@
11

2-
PlackettLuce
3-
============
2+
# PlackettLuce
43

5-
[![Travis-CI Build Status](https://travis-ci.org/hturner/PlackettLuce.svg?branch=master)](https://travis-ci.org/hturner/PlackettLuce) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/hturner/PlackettLuce?branch=master&svg=true)](https://ci.appveyor.com/project/hturner/PlackettLuce) [![Coverage Status](https://img.shields.io/codecov/c/github/hturner/PlackettLuce/master.svg)](https://codecov.io/github/hturner/PlackettLuce?branch=master)
4+
[![Travis-CI Build
5+
Status](https://travis-ci.org/hturner/PlackettLuce.svg?branch=master)](https://travis-ci.org/hturner/PlackettLuce)
6+
[![AppVeyor Build
7+
Status](https://ci.appveyor.com/api/projects/status/github/hturner/PlackettLuce?branch=master&svg=true)](https://ci.appveyor.com/project/hturner/PlackettLuce)
8+
[![Coverage
9+
Status](https://img.shields.io/codecov/c/github/hturner/PlackettLuce/master.svg)](https://codecov.io/github/hturner/PlackettLuce?branch=master)
610

711
Package website: <https://hturner.github.io/PlackettLuce/>.
812

9-
Overview
10-
--------
13+
## Overview
1114

12-
The **PlackettLuce** package implements a generalization of the model jointly attributed to Plackett (1975) and Luce (1959) for modelling rankings data. Examples of rankings data might be the finishing order of competitors in a race, or the preference of consumers over a set of competing products.
15+
The **PlackettLuce** package implements a generalization of the model
16+
jointly attributed to Plackett (1975) and Luce (1959) for modelling
17+
rankings data. Examples of rankings data might be the finishing order of
18+
competitors in a race, or the preference of consumers over a set of
19+
competing products.
1320

14-
The output of the model is an estimated **worth** for each item that appears in the rankings. The parameters are generally presented on the log scale for inference.
21+
The output of the model is an estimated **worth** for each item that
22+
appears in the rankings. The parameters are generally presented on the
23+
log scale for inference.
1524

1625
The implementation of the Plackett-Luce model in **PlackettLuce**:
1726

18-
- Accommodates ties (of any order) in the rankings, e.g. bananas ≻ {apples, oranges} ≻ pears.
19-
- Accommodates sub-rankings, e.g. pears ≻ apples, when the full set of items is {apples, bananas, oranges, pears}.
20-
- Handles disconnected or weakly connected networks implied by the rankings, e.g. where one item always loses as in figure below. This is achieved by adding pseudo-rankings with a hypothetical or ghost item.
27+
- Accommodates ties (of any order) in the rankings, e.g. bananas
28+
\(\succ\) {apples, oranges} \(\succ\) pears.
29+
- Accommodates sub-rankings, e.g. pears \(\succ\) apples, when the
30+
full set of items is {apples, bananas, oranges, pears}.
31+
- Handles disconnected or weakly connected networks implied by the
32+
rankings, e.g. where one item always loses as in figure below. This
33+
is achieved by adding pseudo-rankings with a hypothetical or ghost
34+
item.
2135

22-
![](man/figures/always-loses-1.png) </br>
36+
![](man/figures/always-loses-1.png)<!-- --> </br>
2337

2438
In addition the package provides methods for
2539

26-
- Obtaining quasi-standard errors, that don't depend on the constraints applied to the worth parameters for identifiability.
27-
- Fitting Plackett-Luce trees, i.e. a tree that partitions the rankings by covariate values, such as consumer attributes or racing conditions, identifying subgroups with different sets of worth parameters for the items.
40+
- Obtaining quasi-standard errors, that don’t depend on the
41+
constraints applied to the worth parameters for identifiability.
42+
- Fitting Plackett-Luce trees, i.e. a tree that partitions the
43+
rankings by covariate values, such as consumer attributes or racing
44+
conditions, identifying subgroups with different sets of worth
45+
parameters for the items.
2846

29-
Installation
30-
------------
47+
## Installation
3148

3249
The package may be installed from GitHub via
3350

@@ -36,12 +53,19 @@ The package may be installed from GitHub via
3653
devtools::install_github("hturner/PlackettLuce")
3754
```
3855

39-
Usage
40-
-----
56+
## Usage
4157

42-
The [Netflix Prize](http://www.netflixprize.com/) was a competition devised by Netflix to improve the accuracy of its recommendation system. To facilitate this they released ratings about movies from the users of the system that have been transformed to preference data and are available from [PrefLib](http://www.preflib.org/data/election/netflix/). Each data set comprises rankings of a set of 3 or 4 movies selected at random. Here we consider rankings for just one set of movies to illustrate the functionality of **PlackettLuce**.
58+
The [Netflix Prize](http://www.netflixprize.com/) was a competition
59+
devised by Netflix to improve the accuracy of its recommendation system.
60+
To facilitate this they released ratings about movies from the users of
61+
the system that have been transformed to preference data and are
62+
available from [PrefLib](http://www.preflib.org/data/election/netflix/).
63+
Each data set comprises rankings of a set of 3 or 4 movies selected at
64+
random. Here we consider rankings for just one set of movies to
65+
illustrate the functionality of **PlackettLuce**.
4366

44-
The data can be read in using the `read.soc` function in **PlackettLuce**
67+
The data can be read in using the `read.soc` function in
68+
**PlackettLuce**
4569

4670
``` r
4771
library(PlackettLuce)
@@ -54,9 +78,17 @@ head(netflix, 2)
5478
## 1 68 2 1 4 3
5579
## 2 53 1 2 4 3
5680

57-
Each row corresponds to a unique ordering of the four movies in this data set. The number of Netflix users that assigned that ordering is given in the first column, followed by the four movies in preference order. So for example, 68 users ranked movie 2 first, followed by movie 1, then movie 4 and finally movie 3.
81+
Each row corresponds to a unique ordering of the four movies in this
82+
data set. The number of Netflix users that assigned that ordering is
83+
given in the first column, followed by the four movies in preference
84+
order. So for example, 68 users ranked movie 2 first, followed by movie
85+
1, then movie 4 and finally movie 3.
5886

59-
`PlackettLuce`, the model-fitting function in **PlackettLuce** requires that the data are provided in the form of *rankings* rather than *orderings*, i.e. the rankings are expressed by giving the rank for each item, rather than ordering the items. We can create a `"rankings"` object from a set of orderings as follows
87+
`PlackettLuce`, the model-fitting function in **PlackettLuce** requires
88+
that the data are provided in the form of *rankings* rather than
89+
*orderings*, i.e. the rankings are expressed by giving the rank for each
90+
item, rather than ordering the items. We can create a `"rankings"`
91+
object from a set of orderings as follows
6092

6193
``` r
6294
R <- as.rankings(netflix[,-1], input = "ordering")
@@ -69,9 +101,19 @@ R[1:3, as.rankings = FALSE]
69101
## 2 1 2 4 3
70102
## 3 2 1 3 4
71103

72-
Note that `read.soc` saved the names of the movies in the `"item"` attribute of `netflix`, so we have used these to label the items. Subsetting the rankings object `R` with `as.rankings = FALSE`, returns the underlying matrix of rankings corresponding to the subset. So for example, in the first ranking the second movie (Beverly Hills Cop) is ranked number 1, followed by the first movie (Mean Girls) with rank 2, followed by the fourth movie (Mission: Impossible II) and finally the third movie (The Mummy Returns), giving the same ordering as in the original data.
104+
Note that `read.soc` saved the names of the movies in the `"item"`
105+
attribute of `netflix`, so we have used these to label the items.
106+
Subsetting the rankings object `R` with `as.rankings = FALSE`, returns
107+
the underlying matrix of rankings corresponding to the subset. So for
108+
example, in the first ranking the second movie (Beverly Hills Cop) is
109+
ranked number 1, followed by the first movie (Mean Girls) with rank 2,
110+
followed by the fourth movie (Mission: Impossible II) and finally the
111+
third movie (The Mummy Returns), giving the same ordering as in the
112+
original data.
73113

74-
Various methods are provided for `"rankings"` objects, in particular if we subset the rankings without `as.rankings = FALSE`, the result is again a `"rankings"` object and the corresponding print method is used:
114+
Various methods are provided for `"rankings"` objects, in particular if
115+
we subset the rankings without `as.rankings = FALSE`, the result is
116+
again a `"rankings"` object and the corresponding print method is used:
75117

76118
``` r
77119
R[1:3]
@@ -95,7 +137,9 @@ print(R[1:3], width = 60)
95137
## 3
96138
## "Beverly Hills Cop > Mean Girls > The Mummy Returns > Mis ..."
97139

98-
The rankings can now be passed to `PlackettLuce` to fit the Plackett-Luce model. The counts of each ranking provided in the downloaded data are used as weights when fitting the model.
140+
The rankings can now be passed to `PlackettLuce` to fit the
141+
Plackett-Luce model. The counts of each ranking provided in the
142+
downloaded data are used as weights when fitting the model.
99143

100144
``` r
101145
mod <- PlackettLuce(R, weights = netflix$n)
@@ -107,9 +151,13 @@ coef(mod, log = FALSE)
107151
## Mission: Impossible II
108152
## 0.1498342
109153

110-
Calling `coef` with `log = FALSE` gives the worth parameters, constrained to sum to one. These parameters represent the probability that each movie is ranked first.
154+
Calling `coef` with `log = FALSE` gives the worth parameters,
155+
constrained to sum to one. These parameters represent the probability
156+
that each movie is ranked first.
111157

112-
For inference these parameters are converted to the log scale, by default setting the first parameter to zero so that the standard errors are estimable:
158+
For inference these parameters are converted to the log scale, by
159+
default setting the first parameter to zero so that the standard errors
160+
are estimable:
113161

114162
``` r
115163
summary(mod)
@@ -130,34 +178,60 @@ summary(mod)
130178
## AIC: 3499.5
131179
## Number of iterations: 5
132180

133-
In this way, Mean Girls is treated as the reference movie, the positive parameter for Beverly Hills Cop shows this was more popular among the users, while the negative parameters for the other two movies show these were less popular.
181+
In this way, Mean Girls is treated as the reference movie, the positive
182+
parameter for Beverly Hills Cop shows this was more popular among the
183+
users, while the negative parameters for the other two movies show these
184+
were less popular.
134185

135-
Comparisons between different pairs of movies can be made visually by plotting the log-worth parameters with comparison intervals based on quasi standard errors.
186+
Comparisons between different pairs of movies can be made visually by
187+
plotting the log-worth parameters with comparison intervals based on
188+
quasi standard errors.
136189

137190
``` r
138191
qv <- qvcalc(mod)
139192
plot(qv)
140193
```
141194

142-
![](man/figures/qv-1.png)
195+
![](man/figures/qv-1.png)<!-- -->
143196

144-
If the intervals overlap there is no significant difference. So we can see that Beverly Hills Cop is significantly more popular than the other three movies, Mean Girls is significant more popular than The Mummy Returns or Mission: Impossible II, but there was no significant difference in users' preference for these last two movies.
197+
If the intervals overlap there is no significant difference. So we can
198+
see that Beverly Hills Cop is significantly more popular than the other
199+
three movies, Mean Girls is significant more popular than The Mummy
200+
Returns or Mission: Impossible II, but there was no significant
201+
difference in users’ preference for these last two movies.
145202

146-
Going Further
147-
-------------
203+
## Going Further
148204

149-
The full functionality of **PlackettLuce** is illustrated in the package vignette, along with details of the model used in the package and a comparison to other packages. The vignette can be found on the [package website](https://hturner.github.io/PlackettLuce/) or from within R once the package has been installed, e.g. via
205+
The full functionality of **PlackettLuce** is illustrated in the package
206+
vignette, along with details of the model used in the package and a
207+
comparison to other packages. The vignette can be found on the [package
208+
website](https://hturner.github.io/PlackettLuce/) or from within R once
209+
the package has been installed, e.g. via
150210

151211
vignette("Overview", package = "PlackettLuce")
152212

153-
Code of Conduct
154-
---------------
213+
## Code of Conduct
155214

156-
Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by its terms.
215+
Please note that this project is released with a [Contributor Code of
216+
Conduct](CONDUCT.md). By participating in this project you agree to
217+
abide by its terms.
157218

158-
References
159-
----------
219+
## References
160220

161-
Luce, R. Duncan. 1959. *Individual Choice Behavior: A Theoretical Analysis*. doi:[10.2307/2282347](https://doi.org/10.2307/2282347).
221+
<div id="refs" class="references">
162222

163-
Plackett, Robert L. 1975. “The Analysis of Permutations.” *Appl. Statist* 24 (2): 193–202. doi:[10.2307/2346567](https://doi.org/10.2307/2346567).
223+
<div id="ref-Luce1959">
224+
225+
Luce, R. Duncan. 1959. *Individual Choice Behavior: A Theoretical
226+
Analysis*. New York: Wiley.
227+
228+
</div>
229+
230+
<div id="ref-Plackett1975">
231+
232+
Plackett, Robert L. 1975. “The Analysis of Permutations.” *Appl.
233+
Statist* 24 (2):193–202. <https://doi.org/10.2307/2346567>.
234+
235+
</div>
236+
237+
</div>

cran-comments.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1+
## Resubmission
2+
3+
As requested the DESCRIPTION now contains a reference for the Plackett-Luce model.
4+
15
## Test environments
26

7+
(Re-tested with the same results)
8+
39
* Local
410
- Ubuntu 14.04, R 3.4.3
511
- Ubuntu 14.04, R Under development (unstable) (2017-12-04 r73829)
@@ -12,17 +18,8 @@
1218

1319
On Mac/Ubuntu, R CMD check only returns note that this is a new submission.
1420

15-
On Windows, R CMD check returns the same note in the log, however in the
16-
terminal there is the following warning:
21+
On Windows, R CMD check returns the same note in the log, however in the terminal there is the following warning:
1722

18-
* checking CRAN incoming feasibility ...Warning: running command '"pandoc
19-
" "C:\Users\hturner\PlackettLuce.Rcheck\00_pkg_src\PlackettLuce\README.md
20-
" -s --email-obfuscation=references --self-contained -o "C:\Users\hturner
21-
\AppData\Local\Temp\RtmpyQZw3Z\READMEcf025d05abf.html"' had status 99
23+
* checking CRAN incoming feasibility ...Warning: running command '"pandoc" "C:\Users\hturner\PlackettLuce.Rcheck\00_pkg_src\PlackettLuce\README.md" -s --email-obfuscation=references --self-contained -o "C:\Users\hturner\AppData\Local\Temp\RtmpyQZw3Z\READMEcf025d05abf.html"' had status 99
2224

23-
The warning seems to be due to pandoc not finding image files in `man/figures`.
24-
I could successfully run the pandoc command by either changing directory to
25-
"C:\Users\hturner\PlackettLuce.Rcheck\00_pkg_src\PlackettLuce" and calling
26-
pandoc on "README.md", or adding `--resource-path
27-
"C:\Users\hturner\PlackettLuce.Rcheck\00_pkg_src\PlackettLuce` to the call shown
28-
in the warning.
25+
The warning seems to be due to pandoc not finding image files in `man/figures`. I could successfully run the pandoc command by either changing directory to "C:\Users\hturner\PlackettLuce.Rcheck\00_pkg_src\PlackettLuce" and calling pandoc on "README.md", or adding `--resource-path "C:\Users\hturner\PlackettLuce.Rcheck\00_pkg_src\PlackettLuce` to the call shown in the warning.

0 commit comments

Comments
 (0)