Skip to content

Commit e32e48f

Browse files
Copilotosorensen
andcommitted
Add REFERENCES.bib and update README.Rmd with paper reference and example
Co-authored-by: osorensen <21175639+osorensen@users.noreply.github.com>
1 parent fb2b212 commit e32e48f

File tree

2 files changed

+50
-3
lines changed

2 files changed

+50
-3
lines changed

README.Rmd

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
output: github_document
3+
bibliography: inst/REFERENCES.bib
34
---
45

56
<!-- README.md is generated from README.Rmd. Please edit that file -->
@@ -19,7 +20,7 @@ knitr::opts_chunk$set(
1920
[![R-CMD-check](https://github.com/osorensen/BayesMallowsSMC2/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/osorensen/BayesMallowsSMC2/actions/workflows/R-CMD-check.yaml)
2021
<!-- badges: end -->
2122

22-
BayesMallowsSMC2 provides functions for performing sequential inference in the Bayesian Mallows model using the SMC2 algorithm.
23+
BayesMallowsSMC2 provides functions for performing sequential inference in the Bayesian Mallows model using the SMC2 algorithm [@10.1214/25-BA1564].
2324

2425
## Installation
2526

@@ -30,8 +31,43 @@ You can install the development version of BayesMallowsSMC2 from [GitHub](https:
3031
devtools::install_github("osorensen/BayesMallowsSMC2")
3132
```
3233

33-
## Usage
34+
## Example
3435

35-
This package is under development, and is not yet well documented. For examples on how to use it, see the code in the OSF repository https://osf.io/pquk4/.
36+
Here is a basic example using the included `complete_rankings` dataset:
3637

38+
```{r example}
39+
library(BayesMallowsSMC2)
40+
41+
# Fit the model with complete rankings
42+
set.seed(123)
43+
mod <- compute_sequentially(
44+
complete_rankings,
45+
hyperparameters = set_hyperparameters(n_items = 5),
46+
smc_options = set_smc_options(n_particles = 100, n_particle_filters = 1)
47+
)
48+
49+
# Print model summary
50+
print(mod)
51+
```
52+
53+
### Posterior Summaries
54+
55+
We can visualize the posterior distributions of the parameters:
56+
57+
```{r posterior-alpha}
58+
# Posterior distribution of alpha (dispersion parameter)
59+
plot(mod, parameter = "alpha")
60+
```
61+
62+
```{r posterior-tau}
63+
# Posterior distribution of tau (precision parameter)
64+
plot(mod, parameter = "tau")
65+
```
66+
67+
```{r posterior-rho}
68+
# Posterior distribution of rho (ranking positions)
69+
plot(mod, parameter = "rho", items = c(1, 2, 3))
70+
```
71+
72+
## References
3773

inst/REFERENCES.bib

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@article{10.1214/25-BA1564,
2+
author = {{\O}ystein S{\o}rensen and Anja Stein and Waldir Leoncio Netto and David S. Leslie},
3+
title = {{Sequential Rank and Preference Learning with the Bayesian Mallows Model}},
4+
journal = {Bayesian Analysis},
5+
publisher = {International Society for Bayesian Analysis},
6+
pages = {1 -- 26},
7+
keywords = {Mallows mixtures, partial rankings, particle filter, preference learning, SMC2},
8+
year = {2025},
9+
doi = {10.1214/25-BA1564},
10+
URL = {https://doi.org/10.1214/25-BA1564}
11+
}

0 commit comments

Comments
 (0)