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
)

Arguments

U

: initial number of uninfected target cells : numeric

I

: initial number of infected target cells : numeric

V

: initial number of infectious virions : numeric

n

: rate of uninfected cell production : numeric

dU

: rate at which uninfected cells die : numeric

dI

: rate at which infected cells die : numeric

p

: rate at which infected cells produce virus : numeric

g

: unit conversion factor : numeric

b

: rate at which virus infects cells : numeric

blow

: lower bound for infection rate : numeric

bhigh

: upper bound for infection rate : numeric

dV

: rate at which infectious virus is cleared : numeric

dVlow

: lower bound for virus clearance rate : numeric

dVhigh

: upper bound for virus clearance rate : numeric

iter

: max number of steps to be taken by optimizer : numeric

nsample

: number of samples for conf int determination : numeric

rngseed

: seed for random number generator to allow reproducibility : numeric

parscale

: 1 for linear, 2 for log space parameter fitting : numeric

Value

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.

Details

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.

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.

Examples

# 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