calibrate: Calibrate via particle filter grid search using time series...

View source: R/calibration.R

calibrateR Documentation

Calibrate via particle filter grid search using time series of deaths

Description

Calibrate via particle filter grid search using time series of deaths

Usage

calibrate(
  data,
  R0_min,
  R0_max,
  R0_step,
  R0_prior = NULL,
  first_start_date,
  last_start_date,
  day_step,
  Meff_min = 1,
  Meff_max = 1,
  Meff_step = 0.1,
  squire_model = explicit_model(),
  Rt_func = function(R0_change, R0, Meff) {     exp(log(R0) - Meff * (1 - R0_change)) },
  pars_obs = NULL,
  forecast = 0,
  n_particles = 100,
  reporting_fraction = 1,
  treated_deaths_only = FALSE,
  replicates = 100,
  date_R0_change = NULL,
  R0_change = NULL,
  date_ICU_bed_capacity_change = NULL,
  baseline_ICU_bed_capacity = NULL,
  ICU_bed_capacity = NULL,
  date_hosp_bed_capacity_change = NULL,
  baseline_hosp_bed_capacity = NULL,
  hosp_bed_capacity = NULL,
  date_contact_matrix_set_change = NULL,
  baseline_contact_matrix = NULL,
  contact_matrix_set = NULL,
  country = NULL,
  population = NULL,
  dt = 0.1,
  ...
)

Arguments

data

Deaths data to fit to. See example_deaths.csv and particle_filter_data()

R0_min

Minimum value of R0 in the search

R0_max

Maximum value of R0 in the search

R0_step

Step to increment R0 between min and max

R0_prior

Prior for R0. Default = NULL, which is a flat prior. Should be provided as a list with first argument the distribution function and the second the function arguments (excluding quantiles which are worked out based on R0_min and R0_max), e.g. 'list("func" = dnorm, args = list("mean"= 3.5, "sd"= 3))'.

first_start_date

Earliest start date as 'yyyy-mm-dd'

last_start_date

Latest start date as 'yyyy-mm-dd'

day_step

Step to increment date in days

Meff_min

Minimum value of Meff (Movement effect size) in the search. Default = 1, which is the same as Meff_max. If Meff_max and Meff_min are the same then only a 2d grid search is performed based on R0 and start_date

Meff_max

Maximum value of Meff (Movement effect size) in the search. Default = 1, which is the same as Meff_min. If Meff_max and Meff_min are the same then only a 2d grid search is performed based on R0 and start_date

Meff_step

Step to increment Meff (Movement effect size) between min and max. Default = 0.1

squire_model

A squire model. Default = explicit_SEIR()

Rt_func

Function for converting R0, Meff and R0_change. Function must have names arguments of R0, Meff and R0_change. Default is linear relationship on the log scale given by exp(log(R0) - Meff*(1-R0_change)).

pars_obs

list of parameters to use for the comparison function.

forecast

Number of days to forecast forward. Default = 0

n_particles

Number of particles. Positive Integer. Default = 100

reporting_fraction

Reporting fraction. Numeric for what proportion of the total deaths the reported deaths represent. E.g. 0.5 results in the model calibrating to twice the deaths provided by data$deaths

treated_deaths_only

Boolean for whether likelihood is based only on deaths that occur from healthcare systems, i.e. are treated. Default = FALSE, which uses all deaths.

replicates

Replicates to be run. Default = 100

date_R0_change

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

R0_change

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

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_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

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.

date_hosp_bed_capacity_change

Calendar dates at which hospital bed capacity changes set in model_params change. Defaut = NULL, i.e. no 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

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.

date_contact_matrix_set_change

Calendar dates at which the contact matrices set in model_params change. Defaut = NULL, i.e. no 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.

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

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

dt

Time Step. Default = 0.1

...

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

Value

List of dated squire simulations


mrc-ide/squire documentation built on Sept. 10, 2022, 1:11 a.m.