4

I am a beginner in the whole forecasting/regression/time-series topic. While reading "Forecasting: principles and practice" from Rob J Hyndman and George Athana­sopou­los i found something strange.

library(fpp)
test <- tslm(ausbeer ~ trend+season)
#summary(test)
#plot(ausbeer, col='grey')
#lines(fitted(test), col='red')
AIC(test)
> 2327.316
CV(test)
      CV          AIC         AICc          BIC        AdjR2 
3582.0767318 1728.5234412 1728.9352059 1748.6345900    0.5377408 

Why is there a difference in the AIC values (Akaike's Information Criterion)? As far as i understood AIC(test) and the AIC value in the CV(test) should be the same.

RandomDude
  • 475
  • 1
  • 7
  • 14
  • 4
    It's very common for different packages/computations to include/exclude different constant terms in the AIC ... – Ben Bolker Sep 03 '15 at 16:10
  • So in order to use AIC for comparing different models i have to take care that i use always the same AIC function!? – RandomDude Sep 04 '15 at 09:51
  • 1
    the difference is between `extractAIC()` (used by `CV()`) which leaves out a constant term, and `AIC()`, which appears to give a computation consistent with the full Normal log-likelihood expression. – Ben Bolker Sep 05 '15 at 03:10
  • https://stat.ethz.ch/pipermail/r-help/2007-December/147855.html ; http://stats.stackexchange.com/questions/43733/what-is-the-difference-between-aic-and-extractaic-in-r – Ben Bolker Sep 05 '15 at 03:18

1 Answers1

2

It's very common for different packages/computations to include/exclude different constant terms in the AIC. Here, the difference is between extractAIC() (used by CV()) which leaves out a constant term, and AIC(), which appears to give a computation consistent with the full Normal log-likelihood expression. Also see What is the difference between AIC() and extractAIC() in R? and https://stat.ethz.ch/pipermail/r-help/2007-December/147855.html

mkt
  • 11,770
  • 9
  • 51
  • 125
  • 2
    I've copied this comment by @BenBolker as a community wiki answer because the comment is, more or less, an answer to this question. We have a dramatic gap between answers and questions. At least part of the problem is that some questions are answered in comments: if comments which answered the question were answers instead, we would have fewer unanswered questions. – mkt Jul 12 '18 at 14:15