pmcmc_drjacoby: Runs an parallel tempering MCMC (drjacoby) on the specified...

View source: R/pmcmc_lmic_drjacoby.R

pmcmc_drjacobyR Documentation

Runs an parallel tempering MCMC (drjacoby) on the specified model. Adapted from squire::pmcmc, but handles the weekly death data from excess-mortality.

Description

Runs an parallel tempering MCMC (drjacoby) on the specified model. Adapted from squire::pmcmc, but handles the weekly death data from excess-mortality.

Usage

pmcmc_drjacoby(
  data,
  replicates = 100,
  n_mcmc,
  n_burnin,
  date_vaccine_change,
  primary_doses,
  booster_doses,
  n_chains = 1,
  log_likelihood = NULL,
  log_prior = NULL,
  drjacoby_list = list(),
  squire_model = nimue_booster_model(),
  pars_obs = list(phi_cases = 1, k_cases = 2, phi_death = 1, k_death = 2, exp_noise =
    1e+06, cases_fitting = TRUE, cases_days = 21, cases_reporting = 21, variant_adjust =
    NULL),
  pars_init = list(start_date = as.Date("2020-02-07"), R0 = 2.5, Meff = 2, Meff_pl = 3),
  pars_min = list(start_date = as.Date("2020-02-01"), R0 = 0, Meff = 1, Meff_pl = 2),
  pars_max = list(start_date = as.Date("2020-02-20"), R0 = 5, Meff = 3, Meff_pl = 4),
  pars_discrete = list(start_date = TRUE, R0 = FALSE, Meff = FALSE, Meff_pl = FALSE),
  country = NULL,
  population = NULL,
  contact_matrix_set = NULL,
  baseline_contact_matrix = NULL,
  date_contact_matrix_set_change = NULL,
  R0_change = NULL,
  date_R0_change = NULL,
  hosp_bed_capacity = NULL,
  baseline_hosp_bed_capacity = NULL,
  date_hosp_bed_capacity_change = NULL,
  ICU_bed_capacity = NULL,
  baseline_ICU_bed_capacity = NULL,
  date_ICU_bed_capacity_change = NULL,
  baseline_primary_doses = 0,
  baseline_booster_doses = 0,
  baseline_vaccine_efficacy_infection = vaccine_pars_booster$vaccine_efficacy_infection,
  vaccine_efficacy_infection = NULL,
  baseline_vaccine_efficacy_disease = vaccine_pars_booster$vaccine_efficacy_disease,
  vaccine_efficacy_disease = NULL,
  date_vaccine_efficacy_change = NULL,
  Rt_args = NULL,
  second_dose_delay = 60,
  protection_delay_rate = 1/7,
  protection_delay_shape = 2,
  ...
)

Arguments

data

Data to fit to. This must be constructed with particle_filter_data

replicates

number of trajectories (replicates) to be returned that are being sampled from the posterior probability results produced by run_mcmc_chain to select parameter set. For each parmater set sampled, run particle filter with n_particles and sample 1 trajectory

n_mcmc

number of mcmc mcmc iterations to perform

n_burnin

How many iterations to drop as burnin

date_vaccine_change

Date that vaccine doses per day change. Default = NULL.

primary_doses

Time series of primary vaccine doses

booster_doses

Time series of booster vaccine doses

n_chains

number of MCMC chains to run

log_likelihood

function to calculate log likelihood, must take named parameter vector as input, allow passing of implicit arguments corresponding to the main function arguments. Returns a named list, with entries: - $log_likelihood, a single numeric - $sample_state, a numeric vector corresponding to the state of a single particle, chosen at random, at the final time point for which we have data. If NULL, calculated using the function calc_loglikelihood.

log_prior

function to calculate log prior, must take named parameter vector as input, returns a single numeric. If NULL, uses uninformative priors which do not affect the posterior

drjacoby_list

Parameters to use in drjacoby

squire_model

A squire model to use

pars_obs

list of parameters to use in comparison with compare. Must be a list containing, e.g. list(phi_cases = 0.1, k_cases = 2, phi_death = 1, k_death = 2, exp_noise = 1e6)

pars_init

named list of initial inputs for parameters being sampled

pars_min

named list of lower reflecting boundaries for parameter proposals

pars_max

named list of upper reflecting boundaries for parameter proposals

pars_discrete

named list of logicals, indicating if proposed jump should be discrete

country

Character for country beign simulated. WIll be used to generate population and contact_matrix_set if unprovided. Either country or population and contact_matrix_set must be provided.

population

Population vector (for each age group). Default = NULL, which will cause population to be sourced from country

contact_matrix_set

List of contact matrices to be used from the dates provided in date_contact_matrix_set_change.Must be same length as date_contact_matrix_set_change

baseline_contact_matrix

The starting contact matrix prior to any changes due to interventions or otherwise. Default = NULL, which will use the contact matrix associated with the coutnry provided.

date_contact_matrix_set_change

Calendar dates at which the contact matrices set in model_params change. Defaut = NULL, i.e. no change

R0_change

Numeric vector for relative changes in R0. Default = NULL, i.e. no change in R0

date_R0_change

Calendar dates at which R0_change occurs. Defaut = NULL, i.e. no change in R0

hosp_bed_capacity

Number of hospital beds at each date specified in date_hosp_bed_capacity_change. Must be same length as date_hosp_bed_capacity_change.

baseline_hosp_bed_capacity

The starting number of hospital beds before the epidemic started. Default = NULL, which will use the hospital beds data for the country provided. If no country is provided then this is 5/1000 of the population

date_hosp_bed_capacity_change

Calendar dates at which hospital bed capacity changes set in model_params change. Defaut = NULL, i.e. no change

ICU_bed_capacity

Number of ICU beds at each date specified in date_ICU_bed_capacity_change. Must be same length as date_ICU_bed_capacity_change.

baseline_ICU_bed_capacity

The starting number of ICU beds before the epidemic started. Default = NULL, which will use the hospital beds data for the country provided. If no country is provided then this is 3/100 of hospital beds

date_ICU_bed_capacity_change

Calendar dates at which ICU bed capacity changes set in model_params change. Defaut = NULL, i.e. no change

baseline_primary_doses

Primary doses a day at the start of the epidemic

baseline_booster_doses

Booster doses a day at the start of the epidemic

baseline_vaccine_efficacy_infection

Baseline vaccine effacy against infection. Default = NULL

vaccine_efficacy_infection

Time varying vaccine efficacy against infection. Default = NULL.

baseline_vaccine_efficacy_disease

Baseline vaccine efficacy against disease Default = NULL

vaccine_efficacy_disease

Time varying vaccine efficacy against infection. Default = NULL.

date_vaccine_efficacy_change

Dates at which VE changes

Rt_args

List of arguments to be passed to evaluate_Rt_pmcmc for calculating Rt. Current arguments are available in Rt_args_list

second_dose_delay

Delay in days between first and second doses

protection_delay_rate

Assuming vaccine protection is delayed by some gamma distribution, specify the rate

protection_delay_shape

Assuming vaccine protection is delayed by some gamma distribution, specify the shape

...

Further aguments for the model parameter function. If using the explicit_model (default) this will be parameters_explicit_SEEIR.


mrc-ide/squire.page documentation built on May 27, 2023, 11:20 a.m.