This function runs a simulation of a compartment model using a set of ordinary differential equations. The user provides initial conditions and parameter values for the system. The function simulates the ODE using an ODE solver from the deSolve package. The function returns a matrix containing time-series of each variable and time.

simulate_modelvariants_ode(
  U = 1e+05,
  I = 0,
  V = 10,
  F = 0,
  A = 0,
  n = 0,
  dU = 0,
  dI = 1,
  dV = 4,
  b = 1e-05,
  p = 100,
  pF = 1,
  dF = 1,
  f1 = 1e-04,
  f2 = 0,
  f3 = 0,
  Fmax = 1000,
  sV = 1e-10,
  k1 = 0.001,
  k2 = 0,
  k3 = 0,
  a1 = 1000,
  a2 = 0,
  a3 = 0,
  hV = 1e-10,
  k4 = 0.001,
  k5 = 0,
  k6 = 0,
  sA = 1e-10,
  dA = 0.1,
  tstart = 0,
  tfinal = 20,
  dt = 0.01
)

Arguments

U

: initial number of uninfected target cells : numeric

I

: initial number of infected target cells : numeric

V

: initial number of infectious virions : numeric

F

: initial level of innate response : numeric

A

: initial level of adaptive response : numeric

n

: rate of uninfected cell production : numeric

dU

: rate of natural death of uninfected cells : numeric

dI

: rate at which infected cells die : numeric

dV

: rate at which infectious virus is cleared : numeric

b

: rate at which virus infects cells : numeric

p

: rate at which infected cells produce virus : numeric

pF

: rate of innate response production in absence of infection : numeric

dF

: rate of innate response removal in absence of infection : numeric

f1

: growth of innate response alternative 1 : numeric

f2

: growth of innate response alternative 2 : numeric

f3

: growth of innate response alternative 3 : numeric

Fmax

: maximum level of innate response in alternative 1 : numeric

sV

: saturation of innate response growth in alternative 2 and 3 : numeric

k1

: action of innate response alternative 1 : numeric

k2

: action of innate response alternative 2 : numeric

k3

: action of innate response alternative 3 : numeric

a1

: growth of adaptive response alternative 1 : numeric

a2

: growth of adaptive response alternative 2 : numeric

a3

: growth of adaptive response alternative 3 : numeric

hV

: saturation of adaptive response growth in alternative 2 and 3 : numeric

k4

: action of adaptive response alternative 1 : numeric

k5

: action of adaptive response alternative 2 : numeric

k6

: action of adaptive response alternative 3 : numeric

sA

: saturation of adaptive response killing for alternative action 2 : numeric

dA

: adaptive immune response decay : 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 from the odesolver as a matrix, with one column per compartment/variable. The first column is time.

Details

A compartmental infection model is simulated as a set of ordinary differential equations, using an ode solver from the deSolve package.

Warning

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

See also

See the Shiny app documentation corresponding to this simulator function for more details on this model. See the manual for the deSolve package for details on the underlying ODE simulator algorithm.

Author

Andreas Handel

Examples

# To run the simulation with default parameters just call the function:
result <- simulate_modelvariants_ode()
# To choose parameter values other than the standard one, specify them, like such:
result <- simulate_modelvariants_ode(V = 100, k1 = 0 , k2 = 0, k3 = 1e-4)
# You should then use the simulation result returned from the function, like this:
plot(result$ts[,"time"],result$ts[,"V"],xlab='Time',ylab='Virus',type='l',log='y')