Conversation
| } | ||
| ``` | ||
|
|
||
| In this vignette, we will demonstrate how to run a resumable malariasimulation model. This functionality can be useful to set time-varying parameters that can not be specified otherwise via malariasimulation helper functions. This can help save computational time in scenario modelling, where model parameters are the same between runs until an intervention is introduced. |
There was a problem hiding this comment.
"This functionality can be useful to set time-varying parameters that can not be specified otherwise via malariasimulation helper functions."
I don't think this is not the intention of the resumable simulations feature. If people want to parameterise time-varying functions, we would ideally want to extend the helper functions to allow them to simulate it in one go.
The following sentence, "this can help save computational time...", sums up the intention nicely.
| # Run a simple simulation | ||
| To begin, we can run a regular simulation using `malariasimulation::run_simulation` for 10 years. | ||
|
|
||
|
|
||
| ```{r} | ||
| year <- 365 | ||
| month <- 30 | ||
| eir<- 35 | ||
|
|
||
| # pull standard parameters | ||
| params <- get_parameters( | ||
| list( | ||
| human_population = 10000, | ||
| individual_mosquitoes = FALSE, | ||
| clinical_incidence_rendering_min_ages = 0, | ||
| clinical_incidence_rendering_max_ages = 5 * year | ||
| ) | ||
| ) | ||
|
|
||
|
|
||
| params <- set_equilibrium(parameters = params, init_EIR = eir) | ||
|
|
||
| output<- run_simulation(params, timesteps= 10 * year) | ||
|
|
||
|
|
||
| plot_incidence(output, label= 'Incidence for control run') | ||
|
|
||
|
|
||
|
|
||
| ``` |
There was a problem hiding this comment.
Perhaps we can remove this? I don't see how it fits into the vignette.
| ``` | ||
|
|
||
|
|
||
| # Introduce interventions to a resumable simulation |
There was a problem hiding this comment.
| # Introduce interventions to a resumable simulation | |
| # Introduce interventions after resuming a simulation |
| * *parameters*: input parameters | ||
| * *correlations*: correlation parameters | ||
| * *intial_state*: the state from which to resume the simulation (not needed for the first phase) | ||
| * *restore_random_state*: boolean, choice to restore the random number generator's state from the checkpoint |
There was a problem hiding this comment.
restore_random_state is an important feature based on conversations with people about stochasticity. Perhaps we should add a plot to the interventions example below where we show the implications of this parameter.
restore_random_state = FALSE is useful if you want to measure stochasticity of the outputs after the pause.
restore_random_state = TRUE is useful if you want a trajectory which would be consistent with an all-in-one simulation
| params <- set_equilibrium(parameters = params, init_EIR = eir) | ||
|
|
||
| # Introduce transmission-blocking vaccine in initial phase with coverage value of 0 | ||
| tbv_timesteps<- 7* year |
There was a problem hiding this comment.
| tbv_timesteps<- 7* year | |
| tbv_timesteps<- 7 * year |
Hi @plietar and @giovannic -- wrote up a quick vignette for the resumable simulation functionality here, mostly based on the tests.
Happy to change things or make things clearer. Just let me know what you think, no rush!