Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added vignette for resumable simulations #324

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

lmhaile
Copy link
Contributor

@lmhaile lmhaile commented Jul 4, 2024

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!

Copy link
Member

@giovannic giovannic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

}
```

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"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.

Comment on lines +47 to +76
# 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')



```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we can remove this? I don't see how it fits into the vignette.

```


# Introduce interventions to a resumable simulation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tbv_timesteps<- 7* year
tbv_timesteps<- 7 * year

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants