This app allows you to explore the effect of specific model parameters on some outcomes of interest for the simple bacteria model. Read about the model in the “Model” tab. Then do the tasks described in the “What to do” tab.
The model used here is the SIR model with births and deaths. It is also used and described in the stochastic SIR app. This model tracks susceptibles, infected/infectious and recovered hosts. The following compartments are included:
The included processes/mechanisms are the following:
The flow diagram for the model implemented in this app is:
Flow diagram for this model.
The deterministic model implemented as set of differential equations is given by the following equations:
\[\dot S = m - bSI - nS\] \[\dot I = bSI - gI - nI\] \[\dot R = gI - nR\]
This is almost the same model as the basic SIR model from the introductory app, with the only difference that this model also allows natural births and deaths.
The new component implemented for this app is the ability to systematically run the simulation multiple times as you scan of values for a specific parameter. Instead of running the simulation once for a given choice of parameter values and looking at the resulting time-series, this app lets you explore the impact of each model parameter on some outcomes. Specifically, we consider the maximum and final value of each variable.
In the app, those outcomes of interest are labeled Smax, Imax, Rmax and Sfinal, Ifinal, Rfinal. You can choose one of the model parameters to be varied between some minimum and maximum value. The other parameter values remain fixed. For each parameter value, the model is run and the outcomes of interest computed. The resulting plot is one showing how those outcomes of interest vary with the parameter you investigated.
While you can do that with some of the other apps too, by manually changing parameters, re-running the simulation, and recording results, this is done here in an automated way. Exploring models in this way, and presenting plots showing how some outcome(s) of interest vary with a specific parameter, is a very common way models are used in research.
The tasks below are described in a way that assumes everything is in units of days (rate parameters, therefore, have units of inverse days).
Play around with the number of different parameter values (the higher the number, the more often the simulation runs and the longer it takes), the minimum and maximum, and linear or logarithmic spacing and plotting.
In this app, you don’t see the model dynamics, i.e. the time-series for the variables. It is being run in the background, but only parts of it, i.e. maximum and final states of variables are recorded. Try to visualize what the S/I/R curves look like, based on your exploration of the simple SIR model app. Then check these ‘virtual’ curves with the results reported in the plot and make sure you understand how each of them comes about. For instance do you understand why Smax is always 1000? Or why Rfinal increases from 0 to 1000 as you increase b? If you have a hard time with this, I suggest you (re)visit the basic SIR model and explore it some more.
With enough practice, it is often possible to intuit specific results based on the underlying equations - but that requires a good bit of modeling practice. As models get more complicated, even experienced modelers can often not intuit what model behavior one should expect as specific parameters vary. Often the only way to find out is by actually running the simulations.
The model we have here is so simple that we can in fact figure out some of the outcomes shown in the plot without having to run simulations but instead by doing some math. Specifically, we can compute the steady states for the different variables. This was one of the tasks in the Patterns of ID app. We repeat it here.
Once the system has settled down, there are no more changes in the numbers for each compartment. Mathematically, that means that the left side of the differential equations becomes 0, and they turn into the following algebraic equations: \(0 = m - bSI - nS\), \(0 = bSI - gI - nI\) and \(0 = gI - nR\). One can solve those equations for each of the compartments to get a mathematical expression of what S/I/R are at steady state. Try to do this. You should find that Ssteady = (g+n)/b and a similar equations for the other variables.
We cannot compute similar mathematical expressions for the maximum values of the variables. In general, as soon as our model reaches a certain level of complexity (maybe around 5 equations and more), getting analytic/mathematical equations for most outcomes of interest is not possible and the numerical approach of running the simulations and looking at the results is the only option we have.
Note that here we focus on a single parameter at a time. With some coding effort, we could change the underlying simulation to loop over say 2 parameters and produce outcomes for sets of parameter values. The results could be plotted as a 2-dimensional heatmap for each outcome. While this could be extended to more than 2 parameters, it will become hard to visualize and long to run. If there are many parameters that could change, a different approach is useful, which you’ll learn about in the Uncertainty and Sensitivity App.
simulate_modelexploration_sir
. You can call them directly, without going through the shiny app. Use the help()
command for more information on how to use the functions directly. If you go that route, you need to use the results returned from this function and produce useful output (such as a plot) yourself.vignette('DSAIDE')
into the R console.