compute_posterior_intervals.SMCMallows: Compute posterior intervals

View source: R/compute_posterior_intervals.R

compute_posterior_intervals.SMCMallowsR Documentation

Compute posterior intervals

Description

This function computes posterior intervals based on the set of samples at the last timepoint of the SMC algorithm.

Usage

## S3 method for class 'SMCMallows'
compute_posterior_intervals(
  model_fit,
  parameter = "alpha",
  level = 0.95,
  decimals = 3L,
  ...
)

Arguments

model_fit

An object of class SMCMallows, returned from smc_mallows_new_item_rank or smc_mallows_new_users.

parameter

Character string defining which parameter to compute posterior intervals for. One of "alpha" or "rho".

level

Decimal number in [0,1] specifying the confidence level. Defaults to 0.95.

decimals

Integer specifying the number of decimals to include in posterior intervals and the mean and median. Defaults to 3.

...

Other arguments. Currently not used.

See Also

Other posterior quantities: assign_cluster(), compute_consensus.BayesMallows(), compute_consensus.SMCMallows(), compute_consensus(), compute_posterior_intervals.BayesMallows(), compute_posterior_intervals(), heat_plot(), plot.BayesMallows(), plot.SMCMallows(), plot_elbow(), plot_top_k(), predict_top_k(), print.BayesMallowsMixtures(), print.BayesMallows()

Examples

# Basic elements
data <- sushi_rankings[1:100, ]
n_items <- ncol(data)
leap_size <- floor(n_items / 5)
metric <- "footrule"
Time <- 20
N <- 100

# Prepare exact partition function
cardinalities <- prepare_partition_function(metric = metric,
                                            n_items = n_items)$cardinalities

# Performing SMC
smc_test <- smc_mallows_new_users(
  R_obs = data, type = "complete", n_items = n_items,
  metric = metric, leap_size = leap_size,
  N = N, Time = Time,
  cardinalities = cardinalities,
  mcmc_kernel_app = 5,
  num_new_obs = 5,
  alpha_prop_sd = 0.5,
  lambda = 0.15,
  alpha_max = 1e6
)

compute_posterior_intervals(smc_test, parameter = "rho")

compute_consensus(model_fit = smc_test, type = "CP")
compute_consensus(model_fit = smc_test, type = "MAP")

compute_posterior_intervals(smc_test, parameter = "alpha")

BayesMallows documentation built on Nov. 25, 2023, 5:09 p.m.