R/simulate_drugresistance_stochastic.R
simulate_drugresistance_stochastic.Rd
Simulation of a stochastic model with the following compartments: Uninfected target cells (U), Infected with wild-type/sensitive and untreated (Is), infected with resistant (Ir), wild-type virus (Vs), resistant virus (Vr).
simulate_drugresistance_stochastic(
U = 1e+05,
Is = 0,
Ir = 0,
Vs = 10,
Vr = 0,
b = 1e-05,
dI = 1,
e = 0,
m = 0.001,
p = 100,
c = 4,
f = 0.1,
rngseed = 100,
tfinal = 30
)
: initial number of target cells : numeric
: initial number of wild-type infected cells : numeric
: initial number of resistant infected cells : numeric
: initial number of wild-type virus : numeric
: initial number of resistant virus : numeric
: level/rate of infection of cells : numeric
: rate of infected cell death : numeric
: efficacy of drug : numeric
: fraction of resistant mutants created : numeric
: virus production rate : numeric
: virus removal rate : numeric
: fitness cost of resistant virus : numeric
: seed for random number generator to allow reproducibility : numeric
: maximum simulation time : numeric
A list. The list has only one element called ts. ts contains the time-series of the simulation. The 1st column of ts is Time, the other columns are the model variables.
A compartmental ID model with several states/compartments is simulated as a stochastic model using the adaptive tau algorithm as implemented by ssa.adaptivetau in the adpativetau package. See the manual of this package for more details. The function returns the time series of the simulated disease as output matrix, with one column per compartment/variable. The first column is time.
This function does not perform any error checking. So if you try to do something nonsensical (e.g. have I0 > PopSize or any negative values or fractions > 1), the code will likely abort with an error message.
See the manual for the adaptivetau package for details on the algorithm. The implemented model is loosely based on: Handel et al 2007 PLoS Comp Bio "Neuraminidase Inhibitor Resistance in Influenza: Assessing the Danger of Its Generation and Spread"
# To run the simulation with default parameters just call the function:
result <- simulate_drugresistance_stochastic()
# To choose parameter values other than the standard one, specify them, like such:
result <- simulate_drugresistance_stochastic(tfinal = 100, e = 0.5)
# You should then use the simulation result returned from the function, like this:
plot(result$ts[,"time"],result$ts[,"Vs"],xlab='Time',ylab='Uninfected cells',type='l')