Get the Akaike information criterion (AIC) for a fitted `pk` object
# S3 method for pk
AIC(
object,
newdata = NULL,
model = NULL,
method = NULL,
exclude = TRUE,
drop_obs = TRUE,
...,
k = 2
)
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()]).
A `pk` object
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`.
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`.
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`.
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`.
Logical: `TRUE` to drop the observations column in the output of [logLik()].
Additional argument. Not in use.
Default 2. The `k` parameter in the log-likelihood formula (see Details). Must be named if used.
Caroline Ring, Gilberto Padilla Mercado
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.
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()