This function runs a simulation of a compartment model using a set of ordinary differential equations. The model describes a simple viral infection system in the presence of drug treatment. 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_modelcomparison_fit(
  U = 1e+06,
  I = 0,
  V = 1,
  X = 1,
  dI = 2,
  dV = 4,
  p = 0.1,
  g = 0,
  k = 0.001,
  a = 0.001,
  alow = 1e-05,
  ahigh = 10,
  b = 0.001,
  blow = 1e-06,
  bhigh = 10,
  r = 0.1,
  rlow = 0.001,
  rhigh = 10,
  dX = 1,
  dXlow = 0.1,
  dXhigh = 10,
  fitmodel = 1,
  iter = 1
)

Arguments

U

: initial number of uninfected target cells : numeric

I

: initial number of infected target cells : numeric

V

: initial number of infectious virions : numeric

X

: initial level of immune response : numeric

dI

: rate at which infected cells die : numeric

dV

: rate at which infectious virus is cleared : numeric

p

: rate at which infected cells produce virus : numeric

g

: unit conversion factor : numeric

k

: rate of killing of infected cells by T-cells (model 1) or virus by Ab (model 2) : numeric

a

: activation of T-cells (model 1) or growth of antibodies (model 2) : numeric

alow

: lower bound for activation rate : numeric

ahigh

: upper bound for activation rate : numeric

b

: rate at which virus infects cells : numeric

blow

: lower bound for infection rate : numeric

bhigh

: upper bound for infection rate : numeric

r

: rate of T-cell expansion (model 1) : numeric

rlow

: lower bound for expansion rate : numeric

rhigh

: upper bound for expansion rate : numeric

dX

: rate at which antibodies decay (model 2) : numeric

dXlow

: lower bound for decay rate : numeric

dXhigh

: upper bound for decay rate : numeric

fitmodel

: fitting model 1 or 2 : numeric

iter

: max number of steps to be taken by optimizer : numeric

Value

The function returns a list containing the best fit timeseries, the best fit parameters, the data and the AICc for the model.

Details

Two simple compartmental ODE models mimicking acute viral infection with T-cells (model 1) or antibodies (model 2) are fitted to data.

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 function for more details on this model.

Author

Andreas Handel

Examples

# To run the code with default parameters just call the function:
if (FALSE) result <- simulate_modelcomparison_fit()
# To apply different settings, provide them to the simulator function, like such:
result <- simulate_modelcomparison_fit(iter = 5, fitmodel = 1)