nlmixr (version 2.0.7)

dynmodel: Fit a non-population dynamic model

Description

Fit a non-population dynamic model

Usage

dynmodel(
  system,
  model,
  inits,
  data,
  fixPars = NULL,
  nlmixrObject = NULL,
  control = list(),
  ...
)

Arguments

system

RxODE object. See RxODE for more details.

model

Error model.

inits

Initial values of system parameters.

data

Dataset to estimate. Needs to be RxODE compatible in EVIDs.

fixPars

Fixed system parameters. Default is NULL.

nlmixrObject

nlmixr object. See nlmixr for more details. Default is NULL.

control

Control options for dynmodel dynmodelControl .

...

Other parameters (ignored)

Value

A dynmodel fit object

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
# dynmodel example --------------------------------------------------------
ode <- "
      kel = CL/V;
      d/dt(X) = -kel*X;
      C=X/V;
      PRED = C
      "
ode_system <- RxODE(model = ode)
model_error_structure <- cp ~ C + add(0.01) + prop(0.01)
inits <- c(CL = 1, V = 10)
control <- dynmodelControl(method = "Nelder-Mead")
fit <-
  try(dynmodel(
    system = ode_system,
    model = model_error_structure,
    data = Bolus_1CPT,
    inits = inits,
    control = control
  ))

# nlmixr model example ----------------------------------------------------------
model_onecmt_bolus <- function() {
  ini({
    CL <- c(0, 5, 10) # Clearance (L/hr)
    V <- c(0, 50, 100) # Volume of Distribution
    prop.err <- c(0, 0.01, 1)
  })
  model({
    kel <- CL / V
    d / dt(X) <- -kel * X
    cp <- X / V
    cp ~ prop(prop.err)
  })
}

# note on some platforms this fit is not successful
fit <- try(nlmixr(object = model_onecmt_bolus, data = Bolus_1CPT, est = "dynmodel"))

if (inherits(fit, "nlmixrDynmodel")) {
 as.dynmodel(fit)
}

# method = "focei" is slightly more flexible and well tested

fit <- try(nlmixr(object = model_onecmt_bolus, data = Bolus_1CPT, est = "focei"))

# }

Run the code above in your browser using DataLab