mcmc: Runs MCMC or optimisation to estimate Rt, cases and reporting...

View source: R/sampling.R

mcmcR Documentation

Runs MCMC or optimisation to estimate Rt, cases and reporting parameters

Description

Runs MCMC or optimisation to estimate Rt, cases and reporting parameters

Usage

mcmc(
  niterations,
  data,
  priors,
  serial_parameters,
  initial_cases_true,
  initial_reporting_parameters,
  initial_Rt,
  reporting_metropolis_parameters = list(mean_step = 0.25, sd_step = 0.1),
  serial_max = 40,
  p_gamma_cutoff = 0.99,
  maximise = FALSE,
  print_to_screen = TRUE,
  nchains = 1,
  is_parallel = FALSE,
  initial_overdispersion = 5,
  is_negative_binomial = FALSE,
  overdispersion_metropolis_sd = 0.25
)

Arguments

niterations

number of MCMC iterations to run or number of iterative maximisations to run

data

a tibble with five columns: time_onset, time_reported, cases_reported, Rt_index, reporting_index

priors

a named list with: 'Rt', 'reporting', 'max_cases'. These take the form: 'Rt' is a named list with elements 'shape' and 'rate' describing the gamma prior for each Rt; 'reporting' is a named list with elements 'mean_mu', 'mean_sigma', 'sd_mu', 'sd_sigma' representing the gamma prior parameters for the mean and sd parameters of the reporting parameters (itself described by a gamma distribution); max cases controls the upper limit of the discrete uniform distribution representing the prior on true cases

serial_parameters

named list of 'mean' and 'sd' of gamma distribution characterising the serial interval distribution

initial_cases_true

a tibble with two columns: "time_onset" and "cases_true", which represents initial estimates of the true number of cases with each onset time.

initial_reporting_parameters

provides initial guesses of the mean and sd of the reporting delay distribution(s). These can be either a named with two named elements ('mean', 'sd') for a time-invariant reporting delay or a tibble with three columns: 'reporting_piece_index', 'mean', 'sd' (where the number of indices corresponds to the number provided in the data frame).

initial_Rt

initial guess of the Rt values in each of the piecewise segments. Provided in the form of a tibble with columns: 'Rt_index' and 'Rt'

reporting_metropolis_parameters

named list of 'mean_step', 'sd_step' containing step sizes for Metropolis step

serial_max

maximum point at which to truncate sum in renewal process

p_gamma_cutoff

a p value (0 <= p <= 1) indicating the threshold above which we deem certainty

maximise

rather than sample a case count give the case count with the maximum probability (by default is FALSE)

print_to_screen

prints progress of MCMC sampling to screen. Defaults to true. Disabled when is_parallel is TRUE.

nchains

number of Markov chains to run. Defaults to 1

is_parallel

Boolean to indicate whether or not to run chains in parallel. Defaults to FALSE.

initial_overdispersion

the initial value of the overdispersion parameter if assuming a negative binomial sampling model (default to 5).

is_negative_binomial

if negative-binomial renewal model specified (defaults to FALSE)

overdispersion_metropolis_sd

the standard deviation of the proposal kernel

Value

a named list of three tibbles: "cases", "Rt" and "reporting" which contain estimates of the model parameters


ben18785/incidenceinflation documentation built on Feb. 8, 2024, 2:36 a.m.