Functions to compute Akaike's information criterion (AIC), the second-order AIC (AICc), as well as their quasi-likelihood counterparts (QAIC, QAICc).

`AICc(mod, return.K = FALSE, second.ord = TRUE, nobs = NULL, ...) `# S3 method for aov
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

# S3 method for betareg
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

# S3 method for clm
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

# S3 method for clmm
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

# S3 method for coxme
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

# S3 method for coxph
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

# S3 method for fitdist
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

# S3 method for fitdistr
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

# S3 method for glm
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, c.hat = 1, ...)

# S3 method for glmmTMB
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, c.hat = 1, ...)

# S3 method for gls
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

# S3 method for gnls
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

# S3 method for hurdle
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

# S3 method for lavaan
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

# S3 method for lm
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

# S3 method for lme
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

# S3 method for lmekin
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

# S3 method for maxlikeFit
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, c.hat = 1, ...)

# S3 method for mer
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

# S3 method for merMod
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

# S3 method for lmerModLmerTest
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

# S3 method for multinom
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, c.hat = 1, ...)

# S3 method for negbin
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

# S3 method for nlme
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

# S3 method for nls
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

# S3 method for polr
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

# S3 method for rlm
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

# S3 method for survreg
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

# S3 method for unmarkedFit
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, c.hat = 1, ...)

# S3 method for vglm
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, c.hat = 1, ...)

# S3 method for zeroinfl
AICc(mod, return.K = FALSE, second.ord = TRUE,
nobs = NULL, ...)

`AICc`

returns the AIC, AICc, QAIC, or QAICc, or the number of
estimated parameters, depending on the values of the arguments.

- mod
an object of class

`aov`

,`betareg`

,`clm`

,`clmm`

,`clogit`

,`coxme`

,`coxph`

,`fitdist`

,`fitdistr`

,`glm`

,`glmmTMB`

,`gls`

,`gnls`

,`hurdle`

,`lavaan`

,`lm`

,`lme`

,`lmekin`

,`maxlikeFit`

,`mer`

,`merMod`

,`lmerModLmerTest`

,`multinom`

,`negbin`

,`nlme`

,`nls`

,`polr`

,`rlm`

,`survreg`

,`vglm`

,`zeroinfl`

, and various`unmarkedFit`

classes containing the output of a model.- return.K
logical. If

`FALSE`

, the function returns the information criterion specified. If`TRUE`

, the function returns K (number of estimated parameters) for a given model.- second.ord
logical. If

`TRUE`

, the function returns the second-order Akaike information criterion (i.e., AICc).- nobs
this argument allows to specify a numeric value other than total sample size to compute the AICc (i.e.,

`nobs`

defaults to total number of observations). This is relevant only for mixed models or various models of`unmarkedFit`

classes where sample size is not straightforward. In such cases, one might use total number of observations or number of independent clusters (e.g., sites) as the value of`nobs`

.- c.hat
value of overdispersion parameter (i.e., variance inflation factor) such as that obtained from

`c_hat`

. Note that values of c.hat different from 1 are only appropriate for binomial GLM's with trials > 1 (i.e., success/trial or cbind(success, failure) syntax), with Poisson GLM's, single-season occupancy models (MacKenzie et al. 2002), dynamic occupancy models (MacKenzie et al. 2003), or*N*-mixture models (Royle 2004, Dail and Madsen 2011). If`c.hat`

> 1,`AICc`

will return the quasi-likelihood analogue of the information criteria requested and multiply the variance-covariance matrix of the estimates by this value (i.e., SE's are multiplied by`sqrt(c.hat)`

). This option is not supported for generalized linear mixed models of the`mer`

or`merMod`

classes.- ...
additional arguments passed to the function.

Marc J. Mazerolle

`AICc`

computes one of the following four information criteria:

Akaike's information criterion (AIC, Akaike 1973), $$-2 *
log-likelihood + 2 * K,$$ where the log-likelihood is the maximum
log-likelihood of the model and *K* corresponds to the number of
estimated parameters.

Second-order or small sample AIC (AICc, Sugiura 1978, Hurvich and
Tsai 1991), $$-2 * log-likelihood + 2 * K * (n/(n - K - 1)),$$
where *n* is the sample size of the data set.

Quasi-likelihood AIC (QAIC, Burnham and Anderson 2002), $$QAIC =
\frac{-2 * log-likelihood}{c-hat} + 2 * K,$$ where *c-hat* is the
overdispersion parameter specified by the user with the argument
`c.hat`

.

Quasi-likelihood AICc (QAICc, Burnham and Anderson 2002), $$QAIC = \frac{-2 * log-likelihood}{c-hat} + 2 * K * (n/(n - K - 1))$$.

Note that AIC and AICc values are meaningful to select among
`gls`

or `lme`

models fit by maximum likelihood. AIC and
AICc based on REML are valid to select among different models that
only differ in their random effects (Pinheiro and Bates 2000).

Akaike, H. (1973) Information theory as an extension of the maximum
likelihood principle. In: *Second International Symposium on
Information Theory*, pp. 267--281. Petrov, B.N., Csaki, F., Eds,
Akademiai Kiado, Budapest.

Anderson, D. R. (2008) *Model-based Inference in the Life
Sciences: a primer on evidence*. Springer: New York.

Burnham, K. P., Anderson, D. R. (2002) *Model Selection and
Multimodel Inference: a practical information-theoretic
approach*. Second edition. Springer: New York.

Burnham, K. P., Anderson, D. R. (2004) Multimodel inference:
understanding AIC and BIC in model selection. *Sociological
Methods and Research* **33**, 261--304.

Dail, D., Madsen, L. (2011) Models for estimating abundance from
repeated counts of an open population. *Biometrics* **67**,
577--587.

Hurvich, C. M., Tsai, C.-L. (1991) Bias of the corrected AIC
criterion for underfitted regression and time series
models. *Biometrika* **78**, 499--509.

MacKenzie, D. I., Nichols, J. D., Lachman, G. B., Droege, S., Royle,
J. A., Langtimm, C. A. (2002) Estimating site occupancy rates when
detection probabilities are less than one. *Ecology* **83**,
2248--2255.

MacKenzie, D. I., Nichols, J. D., Hines, J. E., Knutson, M. G.,
Franklin, A. B. (2003) Estimating site occupancy, colonization, and
local extinction when a species is detected imperfectly. *Ecology*
**84**, 2200--2207.

Pinheiro, J. C., Bates, D. M. (2000) *Mixed-effect models in S and
S-PLUS*. Springer Verlag: New York.

Royle, J. A. (2004) *N*-mixture models for estimating population
size from spatially replicated counts. *Biometrics* **60**,
108--115.

Sugiura, N. (1978) Further analysis of the data by Akaike's
information criterion and the finite corrections. *Communications
in Statistics: Theory and Methods* **A7**, 13--26.

`AICcCustom`

, `aictab`

, `confset`

,
`importance`

, `evidence`

, `c_hat`

,
`modavg`

, `modavgShrink`

,
`modavgPred`

, `useBIC`

,

```
##cement data from Burnham and Anderson (2002, p. 101)
data(cement)
##run multiple regression - the global model in Table 3.2
glob.mod <- lm(y ~ x1 + x2 + x3 + x4, data = cement)
##compute AICc with full likelihood
AICc(glob.mod, return.K = FALSE)
##compute AIC with full likelihood
AICc(glob.mod, return.K = FALSE, second.ord = FALSE)
##note that Burnham and Anderson (2002) did not use full likelihood
##in Table 3.2 and that the MLE estimate of the variance was
##rounded to 2 digits after decimal point
##compute AICc for mixed model on Orthodont data set in Pinheiro and
##Bates (2000)
if (FALSE) {
require(nlme)
m1 <- lme(distance ~ age, random = ~1 | Subject, data = Orthodont,
method= "ML")
AICc(m1, return.K = FALSE)
}
```

Run the code above in your browser using DataLab