smc_mallows_new_users: SMC-Mallows New Users

View source: R/RcppExports.R

smc_mallows_new_usersR Documentation

SMC-Mallows New Users

Description

Function to perform resample-move SMC algorithm where we receive new users with complete rankings at each time step. See Chapter 4 of \insertCitesteinSequentialInferenceMallows2023BayesMallows

Usage

smc_mallows_new_users(
  R_obs,
  type,
  n_items,
  N,
  Time,
  mcmc_kernel_app,
  num_new_obs,
  alpha_prop_sd = 0.5,
  lambda = 0.1,
  alpha_max = 1e+06,
  alpha = 0,
  aug_method = "random",
  logz_estimate = NULL,
  cardinalities = NULL,
  verbose = FALSE,
  metric = "footnote",
  leap_size = 1L
)

Arguments

R_obs

Matrix containing the full set of observed rankings of size n_assessors by n_items

type

One of "complete", "partial", or "partial_alpha_fixed".

n_items

Integer is the number of items in a ranking

N

Integer specifying the number of particles

Time

Integer specifying the number of time steps in the SMC algorithm

mcmc_kernel_app

Integer value for the number of applications we apply the MCMC move kernel

num_new_obs

Integer value for the number of new observations (complete rankings) for each time step

alpha_prop_sd

Numeric value specifying the standard deviation of the lognormal proposal distribution used for \alpha in the Metropolis-Hastings algorithm. Defaults to 0.1.

lambda

Strictly positive numeric value specifying the rate parameter of the truncated exponential prior distribution of \alpha. Defaults to 0.1. When n_cluster > 1, each mixture component \alpha_{c} has the same prior distribution.

alpha_max

Maximum value of alpha in the truncated exponential prior distribution.

alpha

A numeric value of the scale parameter which is known and fixed.

aug_method

A character string specifying the approach for filling in the missing data, options are "pseudolikelihood" or "random".

logz_estimate

Estimate of the partition function, computed with estimate_partition_function.

cardinalities

Cardinalities for exact evaluation of partition function, returned from prepare_partition_function.

verbose

Logical specifying whether to print out the progress of the SMC-Mallows algorithm. Defaults to FALSE.

metric

A character string specifying the distance metric to use in the Bayesian Mallows Model. Available options are "footrule", "spearman", "cayley", "hamming", "kendall", and "ulam".

leap_size

leap_size Integer specifying the step size of the leap-and-shift proposal distribution

Value

a set of particles each containing a value of rho and alpha

See Also

Other modeling: compute_mallows_mixtures(), compute_mallows(), smc_mallows_new_item_rank()

Examples

# Generate basic elements
data <- sushi_rankings[1:100, ]
n_items <- ncol(sushi_rankings)
metric <- "footrule"
num_new_obs <- 10

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

# Calculating rho and alpha samples
samples <- smc_mallows_new_users(
  R_obs = data, type = "complete", n_items = n_items, metric = metric,
  leap_size = floor(n_items / 5), N = 100, Time = nrow(data) / num_new_obs,
  mcmc_kernel_app = 5, cardinalities = cardinalities,
  alpha_prop_sd = 0.1, lambda = 0.001, alpha_max = 1e6,
  num_new_obs = num_new_obs, verbose = TRUE
)

# Studying the structure of the output
str(samples)

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