[R] AIC and BIC from arima()

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Nov 28 22:19:14 CET 2005


On Mon, 28 Nov 2005, Jean-Luc Fontaine wrote:

> My ultimate goal is to best fit time series by comparing AICs and BICs
> (as in Bayesian) from arima() and nnet().

Whoa!  nnet() does not do maximum likelihood fitting so AIC and BIC are 
not even defined.

On the other hand, ?WWWusage has an example of choosing an ARIMA fit by 
AIC.

> I looked at the arima.R source code, but I am afraid I do not
> understand it.
> What I only miss really is the number of parameters p, where: AIC =
> n*log(S/n) + 2*p
> with S the squared residuals and n the number of observations.
>
> Can I get p from arima() (for both non and seasonal cases) result?

By reading the help page:

     coef: a vector of AR, MA and regression coefficients, which can be
           extracted by the 'coef' method.

so length(fit$coef) will tell you how many parameters you have fitted,
and if you read on

      aic: the AIC value corresponding to the log-likelihood. Only valid
           for 'method = "ML"' fits.


You give us no idea where you got the formula for 'AIC' from, but it is 
not that introduced by Akaike (1973, 4) and commonly used in time-series 
(and by arima()).  I think you are applying a formula applicable to linear 
regression for independent observations, incorrectly.  There are really 
are a lot of subtleties here, and although p is well-defined, n is not.
Thus applying Schwarz's criterion (aka BIC in one of its senses) is not at 
all clearcut, a not uncommon situation with non-iid sampling.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list