|
1 | | -#' Set SMC options |
| 1 | +#' Set SMC options for sequential inference |
2 | 2 | #' |
3 | | -#' @param n_particles Number of particles |
4 | | -#' @param n_particle_filters Initial number of particle filters for each |
5 | | -#' particle |
6 | | -#' @param max_particle_filters Maximum number of particle filters. |
7 | | -#' @param resampling_threshold Effective sample size threshold for resampling |
8 | | -#' @param doubling_threshold Threshold for particle filter doubling. If the |
9 | | -#' acceptance rate of the rejuvenation step falls below this threshold, the |
10 | | -#' number of particle filters is doubled. Defaults to 0.2. |
11 | | -#' @param max_rejuvenation_steps Maximum number of rejuvenation steps. If the |
12 | | -#' number of unique particles has not exceeded half the number of particles |
13 | | -#' after this many steps, the rejuvenation is still stopped. |
14 | | -#' @param metric Metric |
15 | | -#' @param resampler resampler |
16 | | -#' @param latent_rank_proposal latent rank proposal |
17 | | -#' @param verbose Boolean |
18 | | -#' @param trace Logical specifying whether to save static parameters at each |
19 | | -#' timestep. |
20 | | -#' @param trace_latent Logical specifying whether to sample and save one |
21 | | -#' complete set of latent rankings for each particle and each timepoint. |
| 3 | +#' This function creates a list of options for the Sequential Monte Carlo (SMC²) |
| 4 | +#' algorithm used in Bayesian inference for the Mallows model. These options |
| 5 | +#' control the behavior of the particle filtering and resampling procedures. |
22 | 6 | #' |
23 | | -#' @return A list |
| 7 | +#' @param n_particles Positive integer specifying the number of particles to use |
| 8 | +#' in the SMC algorithm. Default is 1000. |
| 9 | +#' @param n_particle_filters Positive integer specifying the initial number of |
| 10 | +#' particle filters for each particle. Default is 50. |
| 11 | +#' @param max_particle_filters Positive integer specifying the maximum number |
| 12 | +#' of particle filters allowed. Default is 10000. |
| 13 | +#' @param resampling_threshold Positive numeric value specifying the effective |
| 14 | +#' sample size threshold for triggering resampling. Default is n_particles/2. |
| 15 | +#' @param doubling_threshold Numeric value between 0 and 1 specifying the |
| 16 | +#' threshold for particle filter doubling. If the acceptance rate of the |
| 17 | +#' rejuvenation step falls below this threshold, the number of particle |
| 18 | +#' filters is doubled. Default is 0.2. |
| 19 | +#' @param max_rejuvenation_steps Positive integer specifying the maximum number |
| 20 | +#' of rejuvenation steps. If the number of unique particles has not exceeded |
| 21 | +#' half the number of particles after this many steps, the rejuvenation is |
| 22 | +#' stopped. Default is 20. |
| 23 | +#' @param metric Character string specifying the distance metric to use. |
| 24 | +#' Options include "footrule", "kendall", "spearman", "cayley", "hamming", |
| 25 | +#' and "ulam". Default is "footrule". |
| 26 | +#' @param resampler Character string specifying the resampling method. |
| 27 | +#' Options include "multinomial", "residual", "stratified", and "systematic". |
| 28 | +#' Default is "multinomial". |
| 29 | +#' @param latent_rank_proposal Character string specifying the proposal |
| 30 | +#' distribution for latent rankings. Default is "uniform". |
| 31 | +#' @param verbose Logical value indicating whether to print progress messages |
| 32 | +#' during computation. Default is FALSE. |
| 33 | +#' @param trace Logical value specifying whether to save static parameters at |
| 34 | +#' each timestep. Default is FALSE. |
| 35 | +#' @param trace_latent Logical value specifying whether to sample and save one |
| 36 | +#' complete set of latent rankings for each particle and each timepoint. |
| 37 | +#' Default is FALSE. |
| 38 | +#' |
| 39 | +#' @return A list containing all the SMC options with the specified values. |
| 40 | +#' |
| 41 | +#' @examples |
| 42 | +#' # Default SMC options |
| 43 | +#' opts <- set_smc_options() |
| 44 | +#' |
| 45 | +#' # Custom SMC options with fewer particles and Kendall distance |
| 46 | +#' opts <- set_smc_options( |
| 47 | +#' n_particles = 500, |
| 48 | +#' n_particle_filters = 25, |
| 49 | +#' metric = "kendall", |
| 50 | +#' verbose = TRUE |
| 51 | +#' ) |
| 52 | +#' |
| 53 | +#' # Options for tracing parameters |
| 54 | +#' opts <- set_smc_options( |
| 55 | +#' n_particles = 100, |
| 56 | +#' trace = TRUE, |
| 57 | +#' trace_latent = TRUE |
| 58 | +#' ) |
| 59 | +#' |
24 | 60 | #' @export |
25 | 61 | #' |
26 | 62 | set_smc_options <- function( |
|
0 commit comments