Run pandemic simulation
run_sim(
params,
state = NULL,
start_date = "2020-03-20",
end_date = "2020-05-1",
params_timevar = NULL,
dt = 1,
ndt = 1,
stoch = c(obs = FALSE, proc = FALSE),
stoch_start = NULL,
ratemat_args = NULL,
step_args = list(),
ode_args = list(),
use_ode = FALSE,
condense = TRUE,
condense_args = NULL,
verbose = FALSE,
use_flex = FALSE,
flexmodel = NULL,
obj_fun = NULL
)
named vector of parameters
named vector of states
starting date (Date or character, any sensible D-M-Y format)
ending date (ditto)
four-column data frame containing columns 'Date'; 'Symbol' (parameter name/symbol); 'Value'; and 'Type' (rel_orig
(relative to value at time zero); rel_prev
(relative to previous value); or abs
(absolute value at specified time). If a 'Relative_value' column is present, it is renamed to 'Value' and 'Type' is set to rel_orig
for back-compatibility.
time step for do_step
number of internal time steps per time step
a logical vector with elements "obs" (add obs error?) and "proc" (add process noise?)
dates on which to enable stochasticity (vector of dates with names 'proc' and 'obs')
additional arguments to pass to make_ratemat
additional arguments to pass to do_step
additional arguments to ode
integrate via ODE rather than discrete step?
if TRUE
, use condense.pansim
to reduce the number of variables in the output (in particular, collapse subclasses and return only one I
, H
, and ICU
variable)
arguments to pass to condense
(before adding observation error)
print messages (e.g. about time-varying parameters)?
use flexmodel
approach
optional flexmodel
object
optional TMB objective function computed with
tmb_fun
Other classic_macpan:
add_d_log()
,
add_updated_vaxrate()
,
aggregate_agecats()
,
calibrate_comb()
,
calibrate()
,
check_age_cat_compatibility()
,
check_contact_rate_setting()
,
col_multiply()
,
condense_age()
,
condense_params_vax()
,
condense_state()
,
condense_vax()
,
dev_is_tikz()
,
do_step()
,
expand_params_age()
,
expand_params_desc_age()
,
expand_params_desc_variant()
,
expand_params_desc_vax()
,
expand_params_mistry()
,
expand_params_variant()
,
expand_params_vax()
,
expand_state_age()
,
expand_state_vax()
,
expand_stateval_testing()
,
fix_pars()
,
fix_stored()
,
forecast_ensemble()
,
forecast_sim()
,
getData()
,
get_GI_moments()
,
get_Gbar()
,
get_R0()
,
get_doses_per_day()
,
get_evec()
,
get_kernel_moments()
,
get_opt_pars()
,
get_r()
,
invlink_trans()
,
make_betavec()
,
make_beta()
,
make_jac()
,
make_ratemat()
,
make_state()
,
make_test_wtsvec()
,
make_vaxrate()
,
mk_Nvec()
,
mk_agecats()
,
mk_contact_rate_setting()
,
mk_mistry_Nvec()
,
mk_pmat()
,
mk_vaxcats()
,
mle_fun()
,
non_expanded_states
,
rExp()
,
read_params()
,
repair_names_age()
,
restore()
,
run_sim_ageify()
,
run_sim_break()
,
run_sim_loglin()
,
run_sim_mobility()
,
run_sim_range()
,
show_ratemat()
,
testify()
,
texify()
,
trans_state_vars()
,
update_contact_rate_setting()
,
update_foi()
,
update_params_mistry()
,
vis_model()
,
write_params()
params <- read_params("ICU1.csv")
paramsS <- update(params,c(proc_disp=0.1,obs_disp=100))
paramsSz <- update(paramsS, zeta=5)
state <- make_state(params=params)
time_pars <- data.frame(Date=c("2020-03-20","2020-03-25"),
Symbol=c("beta0","beta0"),
Relative_value=c(0.7,0.1),
stringsAsFactors=FALSE)
res1 <- run_sim(params,state,start_date="2020-02-01",end_date="2020-06-01")
res1X <- run_sim(params,state,start_date="2020-02-01",end_date="2020-06-01",
condense_args=list(keep_all=TRUE))
res1_S <- update(res1, params=paramsS, stoch=c(obs=TRUE, proc=TRUE))
res1_t <- update(res1, params_timevar=time_pars)
#> Warning: specifying params_timevar with Relative_value is deprecated: auto-converting (reported once per session)
res1_S_t <- update(res1_S, params_timevar=time_pars)
#> Warning: specifying params_timevar with Relative_value is deprecated: auto-converting (reported once per session)
res2_S_t <- update(res1_S_t,params=update(paramsS, proc_disp=0.5))
#> Warning: specifying params_timevar with Relative_value is deprecated: auto-converting (reported once per session)
res3_S_t <- update(res2_S_t,stoch_start="2020-04-01")
#> Warning: specifying params_timevar with Relative_value is deprecated: auto-converting (reported once per session)
res3_Sz <- update(res1_S, params=paramsSz)
plot(res3_Sz,log=TRUE,log_lwr=1e-4)