R/simulate_modelcomparison_fit.R
simulate_modelcomparison_fit.Rd
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
)
: initial number of uninfected target cells : numeric
: initial number of infected target cells : numeric
: initial number of infectious virions : numeric
: initial level of immune response : numeric
: rate at which infected cells die : numeric
: rate at which infectious virus is cleared : numeric
: rate at which infected cells produce virus : numeric
: unit conversion factor : numeric
: rate of killing of infected cells by T-cells (model 1) or virus by Ab (model 2) : numeric
: activation of T-cells (model 1) or growth of antibodies (model 2) : numeric
: lower bound for activation rate : numeric
: upper bound for activation rate : numeric
: rate at which virus infects cells : numeric
: lower bound for infection rate : numeric
: upper bound for infection rate : numeric
: rate of T-cell expansion (model 1) : numeric
: lower bound for expansion rate : numeric
: upper bound for expansion rate : numeric
: rate at which antibodies decay (model 2) : numeric
: lower bound for decay rate : numeric
: upper bound for decay rate : numeric
: fitting model 1 or 2 : numeric
: max number of steps to be taken by optimizer : numeric
The function returns a list containing the best fit timeseries, the best fit parameters, the data and the AICc for the model.
Two simple compartmental ODE models mimicking acute viral infection with T-cells (model 1) or antibodies (model 2) are fitted to data.
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 function for more details on this model.
# 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)