simulate_bacteria_fit {DSAIRM} | R Documentation |
Fitting a simple bacteria infection models to Streptococcus pneumoniae infection data
Description
This function runs a simulation of a compartment model using a set of ordinary differential equations. The model describes a simple bacteria infection system.
Usage
simulate_bacteria_fit(
B = 1,
I = 1,
g = 0.1,
glow = 1e-04,
ghigh = 100,
Bmax = 1e+08,
Bmaxlow = 10000,
Bmaxhigh = 1e+10,
dB = 0.01,
dBlow = 1e-04,
dBhigh = 100,
kI = 0.001,
kIlow = 1e-04,
kIhigh = 100,
rI = 0.1,
rIlow = 1e-04,
rIhigh = 100,
Imax = 10000,
Imaxlow = 1,
Imaxhigh = 1e+10,
dI = 0.1,
dIlow = 0.001,
dIhigh = 100,
iter = 10,
solvertype = 1
)
Arguments
B |
: initial number of bacteria : numeric |
I |
: initial number of neutrophils (immune response) : numeric |
g |
: maximum rate of bacteria growth : numeric |
glow |
: lower bound for g : numeric |
ghigh |
: upper bound for g : numeric |
Bmax |
: bacteria carrying capacity : numeric |
Bmaxlow |
: lower bound for Bmax : numeric |
Bmaxhigh |
: upper bound for Bmax : numeric |
dB |
: bacteria death rate : numeric |
dBlow |
: lower bound for dB : numeric |
dBhigh |
: upper bound for dB : numeric |
kI |
: rate of bacteria killing by immune response : numeric |
kIlow |
: lower bound for k : numeric |
kIhigh |
: upper bound for k : numeric |
rI |
: immune response growth rate : numeric |
rIlow |
: lower bound for r : numeric |
rIhigh |
: upper bound for r : numeric |
Imax |
: immune response carrying capacity : numeric |
Imaxlow |
: lower bound for Imax : numeric |
Imaxhigh |
: upper bound for Imax : numeric |
dI |
: immune response decay rate : numeric |
dIlow |
: lower bound for dI : numeric |
dIhigh |
: upper bound for dI : numeric |
iter |
: max number of steps to be taken by optimizer : numeric |
solvertype |
: the type of solver/optimizer to use (1-3) : numeric |
Details
A simple compartmental ODE model for a bacterial infection is fitted to data. The fitting is done using solvers/optimizers from the nloptr package (which is a wrapper for the nlopt library). The package provides access to a large number of solvers. Here, we only implement 3 solvers, namely 1 = NLOPT_LN_COBYLA, 2 = NLOPT_LN_NELDERMEAD, 3 = NLOPT_LN_SBPLX For details on what those optimizers are and how they work, see the nlopt/nloptr documentation.
Value
The function returns a list containing as elements the best fit time series data frame, the best fit parameters, the data and the final SSR
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.
Author(s)
Andreas Handel
See Also
See the Shiny app documentation corresponding to this function for more details on this model.
Examples
# To run the code with default parameters just call the function:
## Not run: result <- simulate_bacteria_fit()
# To apply different settings, provide them to the simulator function, like such:
result <- simulate_bacteria_fit(iter = 5)