Learn R Programming

invivoPKfit (version 2.0.1)

AIC.pk: Akaike information criterion

Description

Get the Akaike information criterion (AIC) for a fitted `pk` object

Usage

# S3 method for pk
AIC(
  object,
  newdata = NULL,
  model = NULL,
  method = NULL,
  exclude = TRUE,
  drop_obs = TRUE,
  ...,
  k = 2
)

Value

A data.frame with log-likelihood values and calculated AIC using `newdata`. There is one row for each model in `obj`'s [stat_model()] element and each [optimx::optimx()] method (specified in [settings_optimx()]).

Arguments

object

A `pk` object

newdata

Optional: A `data.frame` with new data for which to compute log-likelihood. If NULL (the default), then log-likelihoods will be computed for the data in `object$data`. `newdata` is required to contain at least the following variables: `Time`, `Time.Units`, `Dose`, `Route`,`Media`, `Conc`, `Detect`, `N_Subjects`. Before log-likelihood is calculated, `Time` will be transformed according to the transformation in `object$scales$time` and `Conc` will be transformed according to the transformation in `object$scales$conc`.

model

Optional: Specify one or more of the fitted models for which to calculate log-likelihood. If NULL (the default), log-likelihoods will be returned for all of the models in `object$stat_model`.

method

Optional: Specify one or more of the [optimx::optimx()] methods for which to make predictions and calculate AICs. If NULL (the default), log-likelihoods will be returned for all of the models in `object$settings_optimx$method`.

exclude

Logical: `TRUE` to compute the AIC after removing any observations in the data marked for exclusion (if there is a variable `exclude` in the data, an observation is marked for exclusion when `exclude status. Default `TRUE`.

drop_obs

Logical: `TRUE` to drop the observations column in the output of [logLik()].

...

Additional argument. Not in use.

k

Default 2. The `k` parameter in the log-likelihood formula (see Details). Must be named if used.

Author

Caroline Ring, Gilberto Padilla Mercado

Details

The AIC is calculated from the log-likelihood (LL) as follows: $$\textrm{AIC} = -2\textrm{LL} + k n_{par}$$

where \(n_{par}\) is the number of parameters in the fitted model, and \(k = 2\) for the standard AIC.

See Also

Other fit evaluation metrics: AAFE.pk(), AFE.pk(), BIC.pk(), logLik.pk(), rmse.pk(), rsq.pk()

Other log likelihood functions: BIC.pk(), logLik.pk()

Other methods for fitted pk objects: AAFE.pk(), AFE.pk(), BIC.pk(), coef.pk(), coef_sd.pk(), eval_tkstats.pk(), get_fit.pk(), get_hessian.pk(), get_tkstats.pk(), logLik.pk(), predict.pk(), residuals.pk(), rmse.pk(), rsq.pk()