Simulate Epidemic Dynamics with Threshold-based Policy Control
Epi_MPC_run_wd_thr.RdThis function simulates an epidemic using predefined parameters while dynamically applying threshold-based policy interventions, such as lockdowns, based on rolling averages of deaths.
Usage
Epi_MPC_run_wd_thr(
episimdata,
episettings,
epi_par,
noise_par,
actions,
pred_days,
n_ens = 100,
start_day = 1,
ndays = nrow(episimdata),
R_est_wind = 5,
pathogen = 1,
susceptibles = 1,
delay = 0,
ur = 0,
r_dir = 0,
N = 1e+06
)Arguments
- episimdata
A data frame containing simulation data. It should include columns for
"I"(infected individuals),"C"(cases),"Deaths","S"(susceptible individuals),"R_coeff"(Coefficient of reproduction number reduction by policy), and related epidemiological metrics.- epi_par
A data frame containing epidemiological parameters for the pathogen, including:
"R0": Basic reproduction number."gen_time": Generation time of the disease."gen_time_var": Dispersion of the generation time."CFR": Case fatality rate."mortality_mean": Mean mortality delay."mortality_var": Dispersion of the mortality delay.
- noise_par
A data frame containing noise parameters, such as:
"repd_mean": Reporting delay mean."del_disp": Dispersion for the reporting delay."ur_mean": Mean under-reporting rate."ur_beta_a": Alpha parameter of the Beta distribution for under-reporting.
- actions
A data frame containing control actions. It should include columns for:
"R_coeff": The effect of each policy on the reproduction number.
- pred_days
An integer specifying the number of days to predict ahead for policy evaluation.
- n_ens
An integer specifying the number of ensemble runs for Monte Carlo simulations. Defaults to
100.- start_day
An integer specifying the day to start the simulation. Defaults to
1.- ndays
An integer specifying the total number of simulation days. Defaults to the number of rows in
episimdata.- R_est_wind
An integer specifying the rolling window size for estimating the reproduction number. Defaults to
5.- pathogen
An integer or string identifying the pathogen to extract parameters for. Defaults to
1.- susceptibles
A binary value (
0or1) indicating whether to update the number of susceptibles. Defaults to1.- delay
A binary value (
0or1) indicating whether to simulate reporting delays. Defaults to0.- ur
A binary value (
0or1) indicating whether to simulate under-reporting. Defaults to0.- r_dir
An integer indicating reproduction number adjustments:
1for directRe.2for logistic adjustments.0for using the generation time distribution.
- N
A numeric value representing the total population size. Defaults to
1e6.- LD_on
Threshold for starting lockdown
- LD_off
Threshold for ending lockdown
Value
A data frame containing updated simulation data with computed reproduction numbers, estimated policies, daily infection incidents, cases, deaths, and other epidemic metrics.
Details
The function employs a threshold-based approach to policy control, where interventions such as lockdowns are
triggered based on rolling averages of deaths (Deaths_roll_avg). Deaths may also refer to other metrics that are delayed from infections, e.g. ICU cases. Policies are evaluated periodically,
and transitions occur when the rolling average exceeds or drops below predefined thresholds.
Examples
# Example data and parameters
episimdata <- data.frame(I = c(10, 20), C = c(10, 15), Deaths = c(1, 2), S = c(1000, 990), R_coeff = c(1.0, 0.9))
epi_par <- data.frame(
R0 = 2.5, gen_time = 5, gen_time_var = 1, CFR = 0.02,
mortality_mean = 14, mortality_var = 2
)
noise_par <- data.frame(
repd_mean = 2, del_disp = 1.5, ur_mean = 0.8, ur_beta_a = 2
)
actions <- data.frame(R_coeff = c(1.0, 0.3))
results <- Epi_MPC_run_wd_thr(
episimdata = episimdata, epi_par = epi_par, noise_par = noise_par,
actions = actions, pred_days = 10, n_ens = 50, start_day = 1,
ndays = 20, R_est_wind = 5, pathogen = 1, susceptibles = 1,
delay = 0, ur = 0, r_dir = 0, N = 1e6
)
#> Error in Epi_MPC_run_wd_thr(episimdata = episimdata, epi_par = epi_par, noise_par = noise_par, actions = actions, pred_days = 10, n_ens = 50, start_day = 1, ndays = 20, R_est_wind = 5, pathogen = 1, susceptibles = 1, delay = 0, ur = 0, r_dir = 0, N = 1e+06): argument "episettings" is missing, with no default