Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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

Author(s)

Wenping Wang, Mason McComb and Matt Fidler

Examples

# 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"))

nlmixr

Nonlinear Mixed Effects Models in Population PK/PD

v2.0.4
GPL (>= 2)
Authors
Matthew Fidler [aut] (<https://orcid.org/0000-0001-8538-6691>), Yuan Xiong [aut], Rik Schoemaker [aut] (<https://orcid.org/0000-0002-7538-3005>), Justin Wilkins [aut] (<https://orcid.org/0000-0002-7099-9396>), Wenping Wang [aut, cre], Robert Leary [ctb], Mason McComb [aut] (<https://orcid.org/0000-0001-9871-8616>), Mirjam Trame [ctb], Teun Post [ctb], Richard Hooijmaijers [aut], Hadley Wickham [ctb], Dirk Eddelbuettel [cph], Johannes Pfeifer [ctb], Robert B. Schnabel [ctb], Elizabeth Eskow [ctb], Emmanuelle Comets [ctb], Audrey Lavenu [ctb], Marc Lavielle [ctb], David Ardia [cph], Daniel C. Dillon [ctb], Katharine Mullen [cph], Ben Goodrich [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.