Skip to content

added vignette for resumable simulations#324

Open
lmhaile wants to merge 1 commit intodevfrom
vignettes/resumable
Open

added vignette for resumable simulations#324
lmhaile wants to merge 1 commit intodevfrom
vignettes/resumable

Conversation

@lmhaile
Copy link
Copy Markdown
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
Copy Markdown
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!

Comment thread vignettes/Resumable.Rmd
}
```

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
Copy Markdown
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 thread vignettes/Resumable.Rmd
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
Copy Markdown
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.

Comment thread vignettes/Resumable.Rmd
```


# Introduce interventions to a resumable simulation
Copy link
Copy Markdown
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

Comment thread vignettes/Resumable.Rmd
* *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
Copy Markdown
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

Comment thread vignettes/Resumable.Rmd
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
Copy Markdown
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