predict.nlmixr2FitCore: Predict method for nlmixr2 fit core objects

View source: R/rxsolve.R

predict.nlmixr2FitCoreR Documentation

Predict method for nlmixr2 fit core objects

Description

Generates population- or individual-level predictions from an 'nlmixr2FitCore' object.

Usage

## S3 method for class 'nlmixr2FitCore'
predict(object, ..., level = c("population", "individual"))

Arguments

object

nlmixr2 fit core object to predict

...

additional arguments passed to rxode2::rxSolve or nlmixr2; matching other 'predict' methods, these can include 'newdata' and 'rxControl' settings

level

the prediction level; one of '"population"' (default) or '"individual"'; numeric values '0' and '1' are also accepted

Value

A data frame with predictions

Examples




one.compartment <- function() {
 ini({
  tka <- log(1)
  tcl <- log(10)
  tv <- log(35)
  eta.ka ~ 0.1
  eta.cl ~ 0.1
  eta.v ~ 0.1
  add.sd <- 0.1
 })
 model({
  ka <- exp(tka + eta.ka)
  cl <- exp(tcl + eta.cl)
  v <- exp(tv + eta.v)
  d/dt(depot) = -ka * depot
  d/dt(center) = ka * depot - cl / v * center
  cp = center / v
  cp ~ add(add.sd)
 })
}

# The fit is performed by the function nlmixr/nlmix2 specifying
# the model, data and estimate
fit <- nlmixr2(one.compartment, theo_sd, est = "focei",
               foceiControl(maxOuterIterations = 0L))

# Population predictions
ppred <- predict(fit, theo_sd, level="population")

# Individual predictions
ipred <- predict(fit, theo_sd, level="individual")




nlmixr2est documentation built on Aug. 5, 2026, 1:11 a.m.