Skip to contents

Get the model with the minimum Akaike Information Criterion (AIC) value

Usage

getMinAICFit(..., excludeBoundary = TRUE, k = 2)

Arguments

...

One or more model fits or lists of model fits

excludeBoundary

Exclude a model from selection if it has a parameter at its boundary

k

numeric, the penalty per parameter to be used; the default k = 2 is the classical AIC.

Value

The model fit with the minimum AIC; NULL if no model fits are available after exclusions. If more than one model has the same AIC, the first is returned.

Examples

if (FALSE) { # \dontrun{
d_noec50 <-
  data.frame(
    conc = c(rep(0, 10), rep(1:20, each = 10)),
    DV = c(rnorm(n = 10, mean = 1, sd = 1e-5), rnorm(n = 200, mean = 5, sd = 1e-5)),
    TIME = 0
  )

modEmax <- function() {
  ini({
    e0 = 1
    emax = 5
    ec50 = c(0, 1.1)
    addSd = 0.5
  })
  model({
    effect <- e0 + emax*conc/(ec50 + conc)
    effect ~ add(addSd)
  })
}

modStep <- function() {
  ini({
    e0 = 1
    emax = 5
    addSd = 1e-5
  })
  model({
    effect <- e0 + emax*(conc > 0)
    effect ~ add(addSd)
  })
}

modLinear <- function() {
  ini({
    e0 = 1
    slope = 5
    addSd = 1
  })
  model({
    effect <- e0 + slope*conc
    effect ~ add(addSd)
  })
}

fitEmaxBoundaryIssue <- nlmixr2(modEmax, data = d_noec50, est = "focei", control = list(print = 0))
fitStep <- nlmixr2(modStep, data = d_noec50, est = "focei", control = list(print = 0))
fitLinear <- nlmixr2(modLinear, data = d_noec50, est = "focei", control = list(print = 0))
getMinAICFit(list(fitEmaxBoundaryIssue, fitStep, fitLinear))
} # }