rm(list = ls())
36 Experimenting with Population Heterogeneity in Network Models
In this lab, you will work to extend the network-based SEIR model into an SEIRS model by adding a transition for waning immunity. The specific learning objectives for this lab are to:
- Practice conceptualizing and coding an extension module for EpiModel;
- Practice running a model in
browser
mode for debugging purposes; - Simulate an SEIRS model model with varying waning immunity rates.
36.1 Setup
Once you are ready, start out by clearing your R object environment, to make sure that you do not have any objects lingering from the tutorial. This can be accomplished with:
Next, make sure that you have your module script and analysis run file from the SEIR Tutorial in Chapter 35 ready in your working directory.
36.2 Lab Steps
With your group, take the model in the SEIR Tutorial in Chapter 35 and extend it into an SEIRS model. Specific steps:
- Include an additional stochastic (with
rbinom
again) transition from R to S in the progression function. It is possible here to just copy and paste what is happening with the other transitions, and then modify the status attribute accordingly. You will need to update theget_
functions to pull a new parameter,rs.rate
. - Include epi summary stats for the new flow,
rs.flow
, at each time step. - Source the model functions, and add a new parameter for the waning immunity rate,
rs.rate
, matching the model function.
- Run the model in
browser
mode to step through the new functionality. - Comment out the browser line to stop running in debug mode, resource the module functions, update the control settings to run multiple simulations of the model under different waning immunity rates.
36.3 Lab Questions
After you have completed running the models above, please answer the following questions and discuss in your work group.
- What is the overall impact of varying waning immunity rates on the epidemic outcomes in this model?
- What are additional model components for this SEIRS model that may be missing that you would like to add? How/where would you add them under the EpiModel API?