R/simulate_confint_fit.R
simulate_confint_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.
simulate_confint_fit(
U = 1e+05,
I = 0,
V = 10,
n = 0,
dU = 0,
dI = 2,
p = 0.01,
g = 0,
b = 0.01,
blow = 1e-06,
bhigh = 1000,
dV = 2,
dVlow = 0.001,
dVhigh = 1000,
iter = 20,
nsample = 10,
rngseed = 100,
parscale = 1
)
: initial number of uninfected target cells : numeric
: initial number of infected target cells : numeric
: initial number of infectious virions : numeric
: rate of uninfected cell production : numeric
: rate at which uninfected cells die : numeric
: rate at which infected cells die : numeric
: rate at which infected cells produce virus : numeric
: unit conversion factor : numeric
: rate at which virus infects cells : numeric
: lower bound for infection rate : numeric
: upper bound for infection rate : numeric
: rate at which infectious virus is cleared : numeric
: lower bound for virus clearance rate : numeric
: upper bound for virus clearance rate : numeric
: max number of steps to be taken by optimizer : numeric
: number of samples for conf int determination : numeric
: seed for random number generator to allow reproducibility : numeric
: 1 for linear, 2 for log space parameter fitting : numeric
The function returns a list containing the best fit time series, the best fit parameters for the data, the final SSR, and the bootstrapped 95 percent confidence intervals.
A simple compartmental ODE model mimicking acute viral infection is fitted to data. Confidence intervals are computed by simple bootstrapping of the data using the boot R package. Confidence intervals are computed using the percentage method in boot.ci. See the boot package for more information. This code is part of the DSAIRM R package. For additional model details, see the corresponding app in the DSAIRM 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.
# To run the code with default parameters just call the function:
if (FALSE) result <- simulate_confint_fit()
# To apply different settings, provide them to the simulator function, like such:
result <- simulate_confint_fit(iter = 5, nsample = 5)
#> [1] "All values of t are equal to 0.01749925 \n Cannot calculate confidence intervals"
#> Warning: extreme order statistics used as endpoints