Skip to content

Commit 8b9ebfb

Browse files
committed
compiling docs
1 parent 59ca822 commit 8b9ebfb

File tree

7 files changed

+233
-81
lines changed

7 files changed

+233
-81
lines changed

R/RcppExports.R

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
#'
2222
#' @export
2323
#' @examples
24-
#' # Create simple preference data: item 1 > item 2 > item 3
25-
#' prefs <- matrix(c(1, 2, 2, 3), ncol = 2, byrow = TRUE)
26-
#' colnames(prefs) <- c("top_item", "bottom_item")
24+
#' # Extract preferences from user 1 in the included example data.
25+
#' prefs <- pairwise_preferences[
26+
#' pairwise_preferences$user == 1, c("top_item", "bottom_item"), drop = FALSE]
2727
#'
2828
#' # Generate all topological sorts, but don't save them:
2929
#' sorts <- precompute_topological_sorts(
30-
#' prefs = prefs,
31-
#' n_items = 3,
30+
#' prefs = as.matrix(prefs),
31+
#' n_items = 5,
3232
#' save_frac = 0
3333
#' )
3434
#' # Number of sorts
@@ -38,8 +38,8 @@
3838
#'
3939
#' # Generate all topological sorts and save them:
4040
#' sorts <- precompute_topological_sorts(
41-
#' prefs = prefs,
42-
#' n_items = 3,
41+
#' prefs = as.matrix(prefs),
42+
#' n_items = 5,
4343
#' save_frac = 1
4444
#' )
4545
#' # Number of sorts
@@ -51,19 +51,6 @@ precompute_topological_sorts <- function(prefs, n_items, save_frac) {
5151
.Call(`_BayesMallowsSMC2_precompute_topological_sorts`, prefs, n_items, save_frac)
5252
}
5353

54-
#' Run Sequential Monte Carlo Algorithm (Internal Function)
55-
#'
56-
#' This is an internal function that implements the core SMC² algorithm.
57-
#' Users should typically use \code{\link{compute_sequentially}} instead.
58-
#'
59-
#' @param input_timeseries List of time series data.
60-
#' @param input_prior List of prior parameters.
61-
#' @param input_options List of algorithm options.
62-
#' @param input_sort_matrices List of precomputed sort matrices.
63-
#' @param input_sort_counts List of precomputed sort counts.
64-
#'
65-
#' @return List containing SMC algorithm results.
66-
#' @keywords internal
6754
run_smc <- function(input_timeseries, input_prior, input_options, input_sort_matrices, input_sort_counts) {
6855
.Call(`_BayesMallowsSMC2_run_smc`, input_timeseries, input_prior, input_options, input_sort_matrices, input_sort_counts)
6956
}

README.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@
99
<!-- badges: end -->
1010

1111
BayesMallowsSMC2 provides functions for performing sequential inference
12-
in the Bayesian Mallows model using the SMC$^{2}$ algorithm.
12+
in the Bayesian Mallows model using the SMC$^{2}$ algorithm. The package
13+
implements the methods described in Sørensen, Frigessi, and Scheel
14+
(2025).
15+
16+
The Bayesian Mallows model is a probabilistic framework for analyzing
17+
ranking data, and this package extends it to handle sequential learning
18+
scenarios where rankings arrive over time. The SMC$^{2}$ (Sequential
19+
Monte Carlo squared) algorithm enables efficient Bayesian inference by
20+
combining particle filtering with MCMC methods.
1321

1422
## Installation
1523

@@ -23,6 +31,31 @@ devtools::install_github("osorensen/BayesMallowsSMC2")
2331

2432
## Usage
2533

26-
This package is under development, and is not yet well documented. For
27-
examples on how to use it, see the code in the OSF repository
34+
This package implements sequential Bayesian inference for ranking data
35+
using the Mallows model. The main function is `compute_sequentially()`,
36+
which performs SMC$^{2}$ inference as rankings arrive over time.
37+
38+
``` r
39+
library(BayesMallowsSMC2)
40+
41+
# Example usage (see vignettes for detailed examples)
42+
# result <- compute_sequentially(data, hyperparameters, smc_options)
43+
```
44+
45+
For detailed examples and reproducible code, see the OSF repository at
2846
<https://osf.io/pquk4/>.
47+
48+
## References
49+
50+
<div id="refs" class="references csl-bib-body hanging-indent"
51+
entry-spacing="0">
52+
53+
<div id="ref-sorensen2025sequential" class="csl-entry">
54+
55+
Sørensen, Øystein, Arnoldo Frigessi, and Ida Scheel. 2025. “Sequential
56+
Rank and Preference Learning with the Bayesian Mallows Model.” *Bayesian
57+
Analysis*. <https://doi.org/10.1214/25-BA1564>.
58+
59+
</div>
60+
61+
</div>

man/compute_sequentially.Rd

Lines changed: 59 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/precompute_topological_sorts.Rd

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/run_smc.Rd

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/set_hyperparameters.Rd

Lines changed: 35 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)