[R] AIC, AICc, and K
spencer.graves at pdf.com
Sun Dec 5 02:09:26 CET 2004
I don't know the "best" way, but the following looks like it will
tstDF <- data.frame(x=1:3, y=c(1,1,2))
fit0 <- lm(y~1, tstDF)
fitDF <- lm(y~x, tstDF)
fitDF 3 5.842516
fit0 2 8.001399
The function AIC with only 1 argument returns only a single
number. However, given nested models, it returns a data.frame with
colums df and AIC. At least in this example (and I would think in all
other contexts as well), "df" is the K you want.
hope this helps.
Benjamin M. Osborne wrote:
>How can I extract K (number of parameters) from an AIC calculation, both to
>report K itself and to calculate AICc? I'm aware of the conversion from AIC ->
>AICc, where AICc = AIC + 2K(K+1)/(n-K-1), but not sure of how K is calculated
>or how to extract that value from either an AIC or logLik calculation.
>This is probably more of a basic statistics question than an R question, but I
>thank you for your help.
>University of Vermont
>109 Carrigan Drive
>Burlington, VT 05405
>benjamin.osborne at uvm.edu
>R-help at stat.math.ethz.ch mailing list
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Spencer Graves, PhD, Senior Development Engineer
O: (408)938-4420; mobile: (408)655-4567
More information about the R-help