Richard Hardy
Richard Hardy

Reputation: 436

AIC, BIC values of ARIMA with restricted coefficients in R

Different ways of specifying the same AR (or MA) model to be estimated by function arima() in package forecast in R yield different BIC (Bayesian information criterion) values.

Why does this happen?

Consider two models:

(1) AR(1)
(2) AR(2) with coefficient on AR2 restricted to zero

On paper, the two model are the same. However, their estimation might differ (?). Not sure why they produce equal coefficient estimates, equal log-likelihood values and equal AIC values -- but different BIC values.

Since BIC values differ while likelihoods are equal and AIC values are equal, the number of observations used in estimation must be different between the two models. However, the implied difference in the number of observations is not 1 or 2 but much more.

Is this justified, or is it a bug ???

I wonder what the difference is and how BIC is calculated in case (2). I would like to be able to reproduce the results, so I need to understand how things work here.

Below I provide a reproducible example. Having executed it in R, look at the printed BIC, and also AICc, values -- they are different between the models.

library(forecast)
T=1000; seed=1; set.seed(seed); x=rnorm(T) 
model1=arima(x,order=c(1,0,0)                 ,method="CSS-ML",transform.pars=FALSE)
model2=arima(x,order=c(2,0,0),fixed=c(NA,0,NA),method="CSS-ML",transform.pars=FALSE)
print(model1)
print(model2)

The same applies to AR(p) and MA(q) models, which I do not discuss explicitly to keep it simple.

Would be great if someone could explain why this happens. Thanks!

Upvotes: 3

Views: 3637

Answers (1)

Rob Hyndman
Rob Hyndman

Reputation: 31820

The calculation of AICc and BIC is done within the forecast:::print.Arima function, while AIC is returned by arima(). If you look at the code for forecast:::print.Arima you will see the following:

npar <- length(x$coef) + 1
nstar <- length(x$residuals) - x$arma[6] - x$arma[7] * x$arma[5]
bic <- x$aic + npar * (log(nstar) - 2)
aicc <- x$aic + 2 * npar * (nstar/(nstar - npar - 1) - 1)

Note that npar does not take account of non-estimated coefficients (i.e., those restricted to specified values). It assumes that all coefficients in x$coef have been estimated. It would be possible to correct this by using

npar <- length(x$coef[x$mask]) + 1

I've fixed the github version of the package, so the CRAN version will be updated at the next release.

Upvotes: 3

Related Questions