# Example: Set hyperparameters and use them with partial rankings
# Set hyperparameters with default values
hyperparams1 <- set_hyperparameters(n_items = 5)
# Set hyperparameters with custom prior for alpha
# A larger alpha_shape and smaller alpha_rate increases the prior mean
hyperparams2 <- set_hyperparameters(
n_items = 5,
alpha_shape = 2,
alpha_rate = 1
)
# Use the hyperparameters with compute_sequentially
# This example uses partial rankings with a small number of particles
# for fast execution suitable for CRAN checks
set.seed(123)
mod <- compute_sequentially(
partial_rankings,
hyperparameters = hyperparams2,
smc_options = set_smc_options(
n_particles = 20,
n_particle_filters = 4,
max_rejuvenation_steps = 3
)
)
Run the code above in your browser using DataLab