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

View source: R/sampling.R

mcmc_singleR 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_single(
  niterations,
  snapshot_with_Rt_index_df,
  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,
  initial_overdispersion = 5,
  is_negative_binomial = FALSE,
  overdispersion_metropolis_sd = 0.5
)

Arguments

niterations

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

snapshot_with_Rt_index_df

a tibble with four columns: time_onset, time_reported, cases_reported, Rt_index; an optional fifth column can be provided named reporting_piece_index, which specifies which reporting distribubtion each onset time corresponds to

priors

a named list with: 'Rt', 'reporting', 'max_cases' (and optionally 'overdispersion' if using a negative binomial model). 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; 'overdispersion' is a named list specifying the mean and sd of a gamma prior on this parameter

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

whether to estimate MAP values of parameters (if true) or sample parameter values using MCMC (if false). By default this is false.

print_to_screen

prints progress of MCMC sampling to screen. Defaults to true.

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.