R/simulate_modelvariants_ode.R
simulate_modelvariants_ode.Rd
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
)
: initial number of uninfected target cells : numeric
: initial number of infected target cells : numeric
: initial number of infectious virions : numeric
: initial level of innate response : numeric
: initial level of adaptive response : numeric
: rate of uninfected cell production : numeric
: rate of natural death of uninfected cells : numeric
: rate at which infected cells die : numeric
: rate at which infectious virus is cleared : numeric
: rate at which virus infects cells : numeric
: rate at which infected cells produce virus : numeric
: rate of innate response production in absence of infection : numeric
: rate of innate response removal in absence of infection : numeric
: growth of innate response alternative 1 : numeric
: growth of innate response alternative 2 : numeric
: growth of innate response alternative 3 : numeric
: maximum level of innate response in alternative 1 : numeric
: saturation of innate response growth in alternative 2 and 3 : numeric
: action of innate response alternative 1 : numeric
: action of innate response alternative 2 : numeric
: action of innate response alternative 3 : numeric
: growth of adaptive response alternative 1 : numeric
: growth of adaptive response alternative 2 : numeric
: growth of adaptive response alternative 3 : numeric
: saturation of adaptive response growth in alternative 2 and 3 : numeric
: action of adaptive response alternative 1 : numeric
: action of adaptive response alternative 2 : numeric
: action of adaptive response alternative 3 : numeric
: saturation of adaptive response killing for alternative action 2 : numeric
: adaptive immune response decay : numeric
: Start time of simulation : numeric
: Final time of simulation : numeric
: Times for which result is returned : numeric
The function returns the output from the odesolver as a matrix, with one column per compartment/variable. The first column is time.
A compartmental infection model is simulated as a set of ordinary differential equations, using an ode solver from the deSolve package.
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 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.
# 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')