Dear list,
I am confused about two functions in R: AIC(fm) and extractAIC(fm). What is
the difference between two and when do I have to use one over the other? I
have found the similar question previously and still not clear for me to
understand. I also looked at '?AIC' and '?extractAIC' in R, which is also
unclear. I pasted faked data set, fitting summary, and AICs.
Thank you very much in advance!
Steve
> y <- rnorm(100, 10,3)
> x1 <- y + rnorm(100, 5,3)
> x2 <- y + rnorm(100, 10, 5)
> fm <- lm(y ~ x1+x2)
> summary(fm)
Call:
lm(formula = y ~ x1 + x2)
Residuals:
Min 1Q Median 3Q Max
-4.15818 -1.28600 -0.09738 1.34688 4.61042
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.06431 0.77240 -0.083 0.934
x1 0.43208 0.04334 9.970 < 2e-16 ***
x2 0.16926 0.03357 5.043 2.13e-06 ***
---
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
Residual standard error: 1.856 on 97 degrees of freedom
Multiple R-squared: 0.6462, Adjusted R-squared: 0.639
F-statistic: 88.6 on 2 and 97 DF, p-value: < 2.2e-16
> AIC(fm)
[1] 412.4119
> extractAIC(fm)
[1] 3.0000 126.6242
>
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.