forked from ocbe-uio/BayesMallows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
105 lines (69 loc) · 4.03 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
---
output:
github_document:
fig_width: 6
fig_height: 4
bibliography: ./inst/REFERENCES.bib
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
eval=TRUE
)
```
# BayesMallows
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/BayesMallows)](https://cran.r-project.org/package=BayesMallows)
[![R-CMD-check](https://github.com/ocbe-uio/BayesMallows/workflows/R-CMD-check/badge.svg)](https://github.com/ocbe-uio/BayesMallows/actions)
[![codecov](https://codecov.io/gh/ocbe-uio/BayesMallows/branch/master/graph/badge.svg)](https://codecov.io/gh/ocbe-uio/BayesMallows)
This package provides a general framework for analyzing rank and preference data based on the Bayesian Mallows model first described in [Vitelli et al.(2018)](https://jmlr.org/papers/v18/15-481.html).
## Installation
To install the current release, use
```{r,eval=FALSE}
install.packages("BayesMallows")
```
To install the current development version, use
```{r,eval=FALSE}
#install.packages("remotes")
remotes::install_github("ocbe-uio/BayesMallows")
# Set build_vignettes to TRUE to also get the package vignette
remotes::install_github("ocbe-uio/BayesMallows", build_vignettes = TRUE)
```
## Basic Usage Example
To get started, load the package with
```{r}
library(BayesMallows)
```
The package comes with several example datasets. The simplest one contains 12 persons' assessments of the weights of 20 potatoes, either by visual inspection (`potato_visual`) or by lifting the potatoes and comparing their relative weights by hand (`potato_weighing`). To fit a Bayesian Mallows model on the `potato_visual` dataset, we do
```{r}
fit <- compute_mallows(potato_visual)
```
Next, we can see a diagnostic plot for the Metropolis-Hastings algorithm with `assess_convergence()`. The plot below is for the scale parameter, which measures the variation between the individual rankings.
```{r}
assess_convergence(fit)
```
Setting the burnin to 500, we obtain a plot of the posterior distribution of the scale parameter with:
```{r}
plot(fit, burnin = 500)
```
For more examples, please see the vignette, which is based on @sorensen2020, and the function documentation. The vignette can be opened by issuing the following command.
```{r,eval=FALSE}
vignette("BayesMallows")
```
## The Bayesian Mallows Model
### Methodology
The BayesMallows package currently implements the complete model described in @vitelli2018, which includes a large number of distance metrics, handling of missing ranks and pairwise comparisons, and clustering of users with similar preferences. The extension to non-transitive pairwise comparisons by @crispino2019 is also implemented. In addition, the partition function of the Mallows model can be estimated using the importance sampling algorithm of @vitelli2018 and the asymptotic approximation of @mukherjee2016. For a review of ranking models in general, see @liu2019. @crispino2019informative outlines how informative priors can be used within the model.
### Applications
Among the current applications, @liu2019b applied the Bayesian Mallows model for providing personalized recommendations based on clicking data, and @barrett2018 used the model of @crispino2019 to analyze listeners' understanding of music.
### Future Extensions
Plans for future extensions of the package include allowing for analysis of time-varying ranks as described in @asfaw2016, (frequentist) maximum likelihood estimation, and implementation of a variational Bayes algorithm for approximation the posterior distribution.
## Citation
If using the BayesMallows package in academic work, please cite @sorensen2020, in addition to the relevant methodological papers.
```{r}
citation("BayesMallows")
```
## Contribution
This is an open source project, and all contributions are welcome. Feel free to open an [Issue](https://github.com/ocbe-uio/BayesMallows/issues), a [Pull Request](https://github.com/ocbe-uio/BayesMallows/pulls), or to e-mail us.
## References