Description Usage Arguments Details Value Warning Note Author(s) References See Also Examples
Calculates the Akaike information criterion for a fitted model object for which a loglikelihood value has been obtained.
1 2 3 4 5 
object 
Some VGAM object, for example, having
class 
... 
Other possible arguments fed into

corrected 
Logical, perform the finite sample correction? 
k 
Numeric, the penalty per parameter to be used; the default is the classical AIC. 
The following formula is used for VGLMs:
2*loglikelihood
+ k*npar, where npar represents the number of
parameters
in the fitted model, and k = 2 for the usual AIC.
One could assign k = \log(n) (n the number of observations)
for the socalled BIC or SBC (Schwarz's Bayesian criterion).
This is the function AICvlm()
.
This code relies on the loglikelihood being defined, and computed, for the object. When comparing fitted objects, the smaller the AIC, the better the fit. The loglikelihood and hence the AIC is only defined up to an additive constant.
Any estimated scale parameter (in GLM parlance) is used as one parameter.
For VGAMs and CAO the nonlinear effective degrees of freedom for each
smoothed component is used. This formula is heuristic.
These are the functions AICvgam()
and AICcao()
.
The finite sample correction is usually recommended when the sample size is small or when the number of parameters is large. When the sample size is large their difference tends to be negligible. The correction is described in Hurvich and Tsai (1989), and is based on a (univariate) linear model with normally distributed errors.
Returns a numeric value with the corresponding AIC (or BIC, or ...,
depending on k
).
This code has not been doublechecked.
The general applicability of AIC
for the VGLM/VGAM classes
has not been developed fully.
In particular, AIC
should not be run on some VGAM family
functions because of violation of certain regularity conditions, etc.
AIC has not been defined for QRRVGLMs, yet.
Using AIC to compare posbinomial
models
with, e.g., posbernoulli.tb
models,
requires posbinomial(omit.constant = TRUE)
.
See posbinomial
for an example.
A warning is given if it suspects a wrong omit.constant
value
was used.
Where defined,
AICc(...)
is the same as AIC(..., corrected = TRUE)
.
T. W. Yee.
Hurvich, C. M. and Tsai, C.L. (1989). Regression and time series model selection in small samples, Biometrika, 76, 297–307.
VGLMs are described in vglmclass
;
VGAMs are described in vgamclass
;
RRVGLMs are described in rrvglmclass
;
AIC
,
BICvlm
,
TICvlm
,
drop1.vglm
,
extractAIC.vglm
.
1 2 3 4 5 6 7 8 9 10 11 12 13  pneumo < transform(pneumo, let = log(exposure.time))
(fit1 < vglm(cbind(normal, mild, severe) ~ let,
cumulative(parallel = TRUE, reverse = TRUE), data = pneumo))
coef(fit1, matrix = TRUE)
AIC(fit1)
AICc(fit1) # Quick way
AIC(fit1, corrected = TRUE) # Slow way
(fit2 < vglm(cbind(normal, mild, severe) ~ let,
cumulative(parallel = FALSE, reverse = TRUE), data = pneumo))
coef(fit2, matrix = TRUE)
AIC(fit2)
AICc(fit2)
AIC(fit2, corrected = TRUE)

Loading required package: stats4
Loading required package: splines
Call:
vglm(formula = cbind(normal, mild, severe) ~ let, family = cumulative(parallel = TRUE,
reverse = TRUE), data = pneumo)
Coefficients:
(Intercept):1 (Intercept):2 let
9.676093 10.581725 2.596807
Degrees of Freedom: 16 Total; 13 Residual
Residual deviance: 5.026826
Loglikelihood: 25.09026
logitlink(P[Y>=2]) logitlink(P[Y>=3])
(Intercept) 9.676093 10.581725
let 2.596807 2.596807
[1] 56.18052
[1] 62.18052
[1] 62.18052
Call:
vglm(formula = cbind(normal, mild, severe) ~ let, family = cumulative(parallel = FALSE,
reverse = TRUE), data = pneumo)
Coefficients:
(Intercept):1 (Intercept):2 let:1 let:2
9.593308 11.104791 2.571300 2.743550
Degrees of Freedom: 16 Total; 12 Residual
Residual deviance: 4.884404
Loglikelihood: 25.01905
logitlink(P[Y>=2]) logitlink(P[Y>=3])
(Intercept) 9.593308 11.10479
let 2.571300 2.74355
[1] 58.0381
[1] 71.37144
[1] 71.37144
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.