This uses RxODE family of objects, file, or model specification to solve a ODE system.
rxSolve(object, params = NULL, events = NULL, inits = NULL, scale = c(),
covs = NULL, stiff = TRUE, transit_abs = NULL, atol = 1e-06,
rtol = 1e-06, maxsteps = 5000, hmin = 0, hmax = NULL, hini = 0,
maxordn = 12, maxords = 5, ..., covs_interpolation = c("linear",
"constant"), theta = numeric(), eta = numeric(), add.cov = FALSE)# S3 method for RxODE
rxSolve(object, params = NULL, events = NULL,
inits = NULL, scale = c(), covs = NULL, stiff = TRUE,
transit_abs = NULL, atol = 1e-08, rtol = 1e-06, maxsteps = 5000,
hmin = 0, hmax = NULL, hini = 0, maxordn = 12, maxords = 5, ...,
covs_interpolation = c("linear", "constant"), theta = numeric(),
eta = numeric(), matrix = FALSE, add.cov = FALSE)
# S3 method for solveRxODE
rxSolve(object, params = NULL, events = NULL,
inits = NULL, scale = c(), covs = NULL, stiff = TRUE,
transit_abs = NULL, atol = 1e-08, rtol = 1e-06, maxsteps = 5000,
hmin = 0, hmax = NULL, hini = 0, maxordn = 12, maxords = 5, ...,
covs_interpolation = c("linear", "constant"), theta = numeric(),
eta = numeric(), matrix = FALSE, add.cov = FALSE)
is a either a RxODE family of objects, or a file-name with a RxODE model specification, or a string with a RxODE model specification.
a numeric named vector with values for every parameter in the ODE system; the names must correspond to the parameter identifiers used in the ODE specification;
an eventTable
object describing the input
(e.g., doses) to the dynamic system and observation sampling
time points (see eventTable
);
a vector of initial values of the state variables (e.g., amounts in each compartment), and the order in this vector must be the same as the state variables (e.g., PK/PD compartments);
a numeric named vector with scaling for ode
parameters of the system. The names must correstond to the
parameter identifiers in the ODE specification. Each of the
ODE variables will be divided by the scaling factor. For
example scale=(center=2)
will divide the center ODE
variable by 2.
a matrix or dataframe the same number of rows as the
sampling points defined in the events eventTable
. This
is for time-varying covariates.
a logical (TRUE
by default) indicating whether
the ODE system is stiff or not.
For stiff ODE sytems (stiff = TRUE
), RxODE
uses the
LSODA (Livermore Solver for Ordinary Differential Equations)
Fortran package, which implements an automatic method switching
for stiff and non-stiff problems along the integration
interval, authored by Hindmarsh and Petzold (2003).
For non-stiff systems (stiff = FALSE
), RxODE
uses
DOP853, an explicit Runge-Kutta method of order 8(5, 3) of
Dormand and Prince as implemented in C by Hairer and Wanner
(1993).
boolean indicating if this is a transit compartment absorption
a numeric absolute tolerance (1e-08 by default) used by the ODE solver to determine if a good solution has been achieved;
a numeric relative tolerance (1e-06 by default) used by the ODE solver to determine if a good solution has been achieved.
maximum number of (internally defined) steps allowed during one call to the solver. (5000 by default)
The minimum absolute step size allowed. The default value is 0.
The maximum absolute step size allowed. The default checks for the maximum difference in times in your sampling and events, and uses this value. The value 0 is equivalent to infinite maximum absolute step size.
The step size to be attempted on the first step. The default value is determined by the solver (when hini = 0)
The maximum order to be allowed for the nonstiff (Adams) method. The default is 12. It can be between 1 and 12.
The maximum order to be allowed for the stiff (BDF) method. The default value is 5. This can be between 1 and 5.
Other arguments including scaling factors for each compartment. This includes S# = numeric will scale a compartment # by a dividing the compartment amount by the scale factor, like NONMEM.
specifies the interpolation method for
time-varying covariates. When solving ODEs it often samples
times outside the sampling time specified in events
.
When this happens, the time varying covariates are
interpolated. Currently this can be "linear"
interpolation (the default), which interpolates the covariate
by solving the line between the observed covariates and
extrapolating the new covariate value. The other possibility is
"constant"
, or Last observation carried forward. In this
approach, the last observation of the covariate is considered
the current value of the covariate.
A vector of parameters that will be named THETA[#] and added to inits
A vector of parameters that will be named ETA[#] and added to inits
A boolean indicating if covariates should be added to the output matrix or data frame. By default this is disabled.
A boolean inticating if a matrix should be returned instead of the RxODE's solved object
An “rxSolve” solve object that stores the solved value in a matrix with as many rows as there are sampled time points and as many columns as system variables (as defined by the ODEs and additional assignments in the RxODE model code). It also stores information about the call to allow dynmaic updating of the solved object.
The operations for the object are simialar to a data-frame, but
expand the $
and [[""]]
access operators and
assignment operators to resolve based on different parameter
values, initial conditions, solver parameters, or events (by
updaing the time
variable).
You can call the eventTable
methods on the solved
object to update the event table and resolve the system of
equations.
Hindmarsh, A. C. ODEPACK, A Systematized Collection of ODE Solvers. Scientific Computing, R. S. Stepleman et al. (Eds.), North-Holland, Amsterdam, 1983, pp. 55-64.
Petzold, L. R. Automatic Selection of Methods for Solving Stiff and Nonstiff Systems of Ordinary Differential Equations. Siam J. Sci. Stat. Comput. 4 (1983), pp. 136-148.
Hairer, E., Norsett, S. P., and Wanner, G. Solving ordinary differential equations I, nonstiff problems. 2nd edition, Springer Series in Computational Mathematics, Springer-Verlag (1993).