A basic bacteria infection model with 2 compartments, implemented as set of ODEs. The model tracks bacteria and an immune response dynamics. The processes modeled are bacteria growth, death and killing by the immune response, and immune response activation and decay.

simulate_basicbacteria_ode(
  B = 100,
  I = 1,
  g = 1,
  Bmax = 1e+05,
  dB = 0.5,
  k = 1e-04,
  r = 1e-04,
  dI = 2,
  tstart = 0,
  tfinal = 100,
  dt = 0.01
)

Arguments

B

: starting value for bacteria : numeric

I

: starting value for immune response : numeric

g

: maximum rate of bacteria growth : numeric

Bmax

: bacteria carrying capacity : numeric

dB

: bacteria death rate : numeric

k

: rate of bacteria killing by immune response : numeric

r

: immune response growth rate : numeric

dI

: immune response decay rate : numeric

tstart

: start time of simulation : numeric

tfinal

: final time of simulation : numeric

dt

: times for which result is returned : numeric

Value

The function returns the output as a list. The time-series from the simulation is returned as a dataframe saved as list element ts. The ts dataframe has one column per compartment/variable. The first column is time.

Details

The model includes bacteria and an immune response. The processes are bacteria growth, death and killing by the immune response, and immune response activation and decay. This is a predator-prey type model. The model is implemented as a set of ordinary differential equations (ODE) using the deSolve package. This code is part of the DSAIRM R package. For additional model details, see the corresponding app in the DSAIRM package.

Notes

The parameter dt only determines the times the solution is returned and plotted, it is not the internal time step for the differential equation solver. The latter is set automatically by the ODE solver.

Warning

This function does not perform any error checking. So if you try to do something nonsensical (e.g. have negative values for parameters), the code will likely abort with an error message.

Examples

# To run the simulation with default parameters:
result <- simulate_basicbacteria_ode()
# To run the simulation with different parameter or starting values,
# supply the ones you want to change.
# all other parameters will be kept at their default values shown in the function call above
result <- simulate_basicbacteria_ode(B = 100, g = 0.5, dI = 2)