Learn R Programming

nlmixr2auto (version 1.0.0)

fitness: Evaluate fitness of a population pharmacokinetic model

Description

Evaluates the quality of a fitted model based on parameter bounds and diagnostic thresholds.

Usage

fitness(
  search.space = "ivbase",
  fit = NULL,
  dat = NULL,
  penalty.control = penaltyControl(),
  objf = "BIC"
)

Value

A data frame extending fit with the following:

  • flag.* columns: indicators of constraint violations (0 = no violation, 1 = mild, 2 = severe).

  • count.constraint.* columns: number of violations per constraint type.

  • fitness: penalized objective function value, computed from the specified objf plus applicable penalties.

Arguments

search.space

Character, one of "ivbase" or "oralbase". Default is "ivbase".

fit

Data frame. Model summary from tools such as get.mod.lst(), with parameter estimates and diagnostics.

dat

A data frame containing pharmacokinetic data in standard nlmixr2 format, including "ID", "TIME", "EVID", and "DV", and may include additional columns.

penalty.control

List created using penaltyControl(), including:

penalty.value

Numeric. Default penalty multiplier used in binary violations.

step.penalties

Numeric vector or list. Penalties applied to step violations (mild, severe).

bounds

List of parameter lower/upper bounds, typically from param.bounds().

thresholds

Named list of diagnostic constraints (e.g., RSE, shrinkage). Each contains a method ("binary" or "step") and the corresponding threshold or step levels.

penalty.terms

Character vector of constraint categories to penalize. Valid terms include "theta", "rse", "omega", "shrinkage", "sigma", "correlation", "covariance", and "total".

objf

Character. Column name in fit used as the base objective function (e.g., "AIC", "BIC", "OBJFV").

Author

Zhonghui Huang

See Also

penaltyControl(), param.bounds().

Examples

Run this code
# \donttest{
# Fit a model (using nlmixr2)
pheno <- function() {
  ini({
    tcl <- log(0.008)
    tv <-  log(0.6)
    eta.cl + eta.v ~ c(1,
                       0.01, 1)
    add.err <- 0.1
  })
  model({
    cl <- exp(tcl + eta.cl)
    v <- exp(tv + eta.v)
    ke <- cl / v
    d/dt(A1) = - ke * A1
    cp = A1 / v
    cp ~ add(add.err)
  })
}
fit <- nlmixr2est::nlmixr2(pheno, pheno_sd, "saem", control = list(print = 0),
              table = list(cwres = TRUE, npde = TRUE))
Store. <- get.mod.lst(fit.s = fit, 1)
 fitness(fit = Store.,dat = pheno_sd)
# }

Run the code above in your browser using DataLab