sample_prior | R Documentation |
Function to obtain samples from the prior distributions of the Bayesian
Mallows model. Intended to be given to update_mallows()
.
sample_prior(n, n_items, priors = set_priors())
n |
An integer specifying the number of samples to take. |
n_items |
An integer specifying the number of items to be ranked. |
priors |
An object of class "BayesMallowsPriors" returned from
|
An object of class "BayesMallowsPriorSample", containing n
independent samples of \alpha
and \rho
.
Other modeling:
burnin()
,
burnin<-()
,
compute_mallows()
,
compute_mallows_mixtures()
,
compute_mallows_sequentially()
,
update_mallows()
# We can use a collection of particles from the prior distribution as
# initial values for the sequential Monte Carlo algorithm.
# Here we start by drawing 1000 particles from the priors, using default
# parameters.
prior_samples <- sample_prior(1000, ncol(sushi_rankings))
# Next, we provide the prior samples to update_mallws(), together
# with the first five rows of the sushi dataset
model1 <- update_mallows(
model = prior_samples,
new_data = setup_rank_data(sushi_rankings[1:5, ]))
plot(model1)
# We keep adding more data
model2 <- update_mallows(
model = model1,
new_data = setup_rank_data(sushi_rankings[6:10, ]))
plot(model2)
model3 <- update_mallows(
model = model2,
new_data = setup_rank_data(sushi_rankings[11:15, ]))
plot(model3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.