This app allows exploration of a stochastic model that is almost identical to the deterministic basic virus infection model. In fact, both models are being run so comparison is possible. Read about the model in the “Model” tab. Then do the tasks described in the “What to do” tab.
This model consists of 3 compartments and is almost identical to the deterministic basic virus infection model. We track the following entities, by assigning each to a compartment:
In addition to specifying the compartments of a model, we need to specify the dynamics determining the changes for each compartment. Broadly speaking, there are processes that increase the numbers in a given compartment/stage, and processes that lead to a reduction.
For this model, we consider the following processes:
The one difference to the deterministic virus model is that we do not include an additional conversion factor to account for experimental units. The reason is that this stochastic model makes the assumption that all entities/variables are in discrete units, i.e. number of cells and number of (infectious) virions, and can only change by integer numbers. Because of that, our model requires that virus is in units of actual virion numbers and we don’t need to convert. That also means that the parameter g of the deterministic model - which we run for comparison - is set to 1.
The diagram illustrating this compartmental model is shown in the figure.
Flow diagram for a simple virus infection model.
If we were to implement this model as a continuous-time, deterministic model, it would have the following set of ordinary differential equations.
\[\dot U = n - dU - bUV\] \[\dot I = bUV - d_I I\] \[\dot V = pI - d_V V - b UV\]
However we use a stochastic model here. For such a model, the differential equation formulation is not valid. One can write down an equivalent formulation as a stochastic model by specifying every possible process (also called transition/event/reaction) that can occur and their propensities (the propensity multiplied with the time step gives the probability that a given process/event/transition occurs). For our model these are the following:
Event type | Transitions | Propensity |
---|---|---|
Production of U | U => U+1 | n*U |
death/removal of U | U => U-1 | dU*U |
infection | U => U-1, V => V-1, I => I+1 | bUV |
death if I | I => I-1 | dI*I |
production of V | V => V+1 | p*I |
removal of V | V => V-1 | dV*V |
Note that the stochastic model does not allow specification of starting time and time step. It always starts at t=0 and the time step depends on the simulation. Therefore to allow comparison with the ODE, the start time for the ODE is fixed to 0. Also the time step at which data is returned is fixed at tfinal/1000.
The important take-home message from this is that for small numbers (e.g. at the start or end of an infection, or when overall numbers are large), stochasticity is often important. Once numbers are fairly large (100s or more), then deterministic models are usually doing a fairly good job describing the system dynamics. (Law of large numbers.)
simulate_basicvirus_stochastic
and simulate_basicvirus_ode
. 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('DSAIRM')
into the R console.