ExtractAIC.glm {HelpersMG} | R Documentation |
Return AIC, AICc or BIC from a glm object
Description
For glm fits the family's aic() function is used to compute the AIC.
The choice between different criteria is done by setting a global option AIC. It can be checked using show.option=TRUE.
Indeed, it is not possible to use the ... parameter due to a bug in some functions of MASS package. If you want to use this function as a replacement for setpAIC(), do extractAIC.glm <- ExtractAIC.glm before.
Usage
ExtractAIC.glm(fit, scale = 0, k = 2, ...)
Arguments
fit |
fitted model, the result of a fitter glm. |
scale |
unused for glm. |
k |
numeric specifying the ‘weight’ of the equivalent degrees of freedom (=: edf) part in the AIC formula. |
... |
further arguments (currently unused because addterm.glm and dropterm.glm using this function do not transmit them). |
Details
ExtractAIC.glm returns AIC, AICc or BIC from a glm object
Value
A numeric named vector of length 2, with first and second elements giving
edf the ‘equivalent degrees of freedom’ for the fitted model fit.
x the Information Criterion for fit.
Author(s)
Modified from stats:::extract.AIC.glm
See Also
Other AIC:
FormatCompareAIC()
,
compare_AIC()
,
compare_AICc()
,
compare_BIC()
Examples
extractAIC.glm <- ExtractAIC.glm
n <- 100
x <- rnorm(n, 20, 2)
A <- rnorm(n, 20, 5)
g <- glm(x ~ A)
extractAIC(g, show.option=TRUE)
options(AIC="AIC")
extractAIC(g)
options(AIC="BIC")
extractAIC(g)
options(AIC="AICc")
extractAIC(g)