A simple formula-based interface for nlmixr2
Usage
nlmixrFormula(
object,
data,
start,
param = NULL,
paramLink = NULL,
...,
residualModel = ~add(addSd)
)Arguments
- object
The formula defining the model (see details)
- data
The data to fit
- start
A named list of starting estimates. The names define the parameters in the model. If a single parameter estimate is desired, it can be given here. If a parameter estimate per factor level is desired, either a single starting estimate can be given across all factor levels or one estimate may be given per factor level. (Specify the factors with the
paramargument.)- param
A formula or list of two-sided formulas giving the model used for parameters. If a parameter is a simple fixed effect, only, then it should not be included here. The right-hand side of a
paramformula names one or more columns indata: factor columns get a separate fixed effect per level; numeric columns get a linear slope. Multiple covariates on the same parameter can be combined with+, e.g.b ~ z + w.- paramLink
Optional named character vector mapping parameter names to a link function.
"identity"(the default) emits<param> <- <linear combination>;"log"wraps the linear combination inexp()so the parameter is strictly-positive on the natural scale. Only parameters that have aparamentry may appear here.- ...
Arguments passed on to
nlmixr2est::nlmixrestestimation method (all methods are shown by `nlmixr2AllEst()`). Methods can be added for other tools
controlThe estimation control object. These are expected to be different for each type of estimation method
tableThe output table control object (like `tableControl()`)
saveBoolean to save a nlmixr2 object in a rds file in the working directory. If
NULL, uses option "nlmixr2.save"envirEnvironment where the nlmixr object/function is evaluated before running the estimation routine.
- residualModel
The residual model formula to use as a one-sided formula. The default is
~ add(addSd); richer models such as~ add(addSd) + prop(propSd)are supported as long as the corresponding sigma parameter names appear instart.
Value
The model fit from nlmixr2est::nlmixr2()
Details
The formula is given with different notation than typical formulas.
The formula notation is inspired by and similar to
lme4::nlmer(). It is a 3-part formula:
dependentVariable~predictorEquation~randomEffects.
The dependentVariable is any variable in the dataset. It
may not include any math; for example, log(DV) is not
allowed.
The predictorEquation is any valid math, and it will be used
directly in the nlmixr2 model.
The randomEffects are one or more random effect parameters
defined by putting the parameter in parentheses and putting a
vertical bar and the grouping parameter. Only one grouping
parameter is allowed for all random effects. An example would be
(slope|ID) to estimate a random effect parameter named
"slope" for each "ID" in the data.
