Simulate Epidemic Dynamics with Model Predictive Control
Epi_MPC_run_wd.RdThis function simulates an epidemic under model predictive control (MPC) using pre-defined parameters. It dynamically evaluates actions to maximize expected rewards and updates epidemic states accordingly.
Usage
Epi_MPC_run_wd(
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 = 1,
N = 1e+06
)Arguments
- episimdata
A data frame containing simulation data. It should include columns such as
"C"(cases),"I"(infected individuals),"Re"(effective reproduction number),"S"(susceptible individuals),"Deaths", and"Lambda"total infectiousness.- epi_par
A data frame containing epidemiological parameters for various pathogens. It should have the following columns:
"R0"(basic reproduction number),"gen_time"(generation time),"gen_time_var"(variance of generation time),"CFR"(case fatality rate),"mortality_mean"(mean mortality delay), and"mortality_var"(mortality delay variance).- noise_par
A data frame containing noise parameters for under-reporting and reporting delays:
"repd_mean": Mean of the reporting delay."del_disp": Dispersion parameter for the reporting delay distribution."ur_mean": Mean for the 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 like
"R_coeff".- pred_days
An integer specifying the number of days to predict ahead in reward calculation.
- n_ens
An integer specifying the number of ensemble runs for expected reward calculation. Defaults to
100.- start_day
An integer specifying the start day of 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 window size for reproduction number estimation. Defaults to
5.- pathogen
An integer or string identifying the pathogen to extract corresponding parameters. 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 specifying the 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.
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 model predictive control strategy where actions are evaluated periodically
(based on a refresh interval, rf). Expected rewards are computed using the Epi_pred_wd function
over a specified prediction horizon, and the optimal action is selected. The simulation incorporates
effects of under-reporting, reporting delays, and susceptible depletion based on the provided parameters.
Examples
# Example epidemiological data
episimdata <- data.frame(C = c(0, 10), I = c(5, 8), Re = c(1.5, NA), S = c(1000, 990), Deaths = c(0, 1))
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(0.9, 1.1))
updated_data <- Epi_MPC_run_wd(
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 = 1, N = 1e6
)
#> Error in Epi_MPC_run_wd(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 = 1, N = 1e+06): argument "episettings" is missing, with no default