Skip to contents

Small-sample (second-order) correction to AIC():

Usage

aicc(object, ...)

# Default S3 method
aicc(object, ...)

# S3 method for class 'drmTMB'
aicc(object, ...)

# S3 method for class 'drmTMB_julia'
anova(object, ..., test = NULL)

Arguments

object

A fitted drmTMB model (either engine), or any object whose logLik() method reports "df" and "nobs" attributes.

...

Unused; present for S3 consistency.

test

Present only so anova.drmTMB_julia() matches the signature of stats::anova(); it is never consulted, because that method refuses.

Value

A single number. When \(n - k - 1 \le 0\) (too few observations for the correction to be defined – a saturated or near-saturated model) the value is Inf, as in DRM.jl.

Details

$$\mathrm{AICc} = \mathrm{AIC} + \frac{2k(k + 1)}{n - k - 1}$$

with \(k\) the number of estimated parameters (the "df" attribute of logLik()) and \(n\) the number of observations (the "nobs" attribute). The correction is strictly positive, so aicc(fit) > AIC(fit), and it vanishes as \(n \to \infty\). Prefer AICc over AIC when \(n / k\) is small (a common rule of thumb is \(n / k < 40\)). Like AIC, AICc compares models fit by maximum likelihood on the same data; lower is better.

This is the R port of DRM.jl's aicc(fit) (src/comparison.jl); the two agree to 1e-8 on the same fit.

On a REML fit the same caveat as AIC() applies and the same warning is emitted: the restricted likelihood is comparable only across models with identical fixed effects. Experimental MSPL fits do not expose a likelihood and error, as they do for AIC().

See also

Examples

# \donttest{
set.seed(1)
n <- 60
x <- rnorm(n)
dat <- data.frame(y = 0.5 - 0.8 * x + exp(-0.3 + 0.4 * x) * rnorm(n), x = x)
fit <- drmTMB(bf(y ~ x, sigma ~ x), family = gaussian(), data = dat)
aicc(fit) > AIC(fit)   # the correction is strictly positive
#> [1] TRUE
# }