赤池情報量基準/Akaike’s Information Criterion

Equation
\textup{AIC} =-2\ln L +2k
L:最大尤度(maximum likelihood)、k:パラメーター数(number of parameters)

R
サンプルデータ:リーマンショック以降のWTI原油価格

oiloilaic

> library(tseries)
> oil <- ts(dataset$oilwti,start=c(2008,9),frequency=12)
> plot(oil,main="Crued Oil Price(WTI)",xlab="date",ylab="$/bbl",ylim=c(0,150))
> adf.test(oil)

        Augmented Dickey-Fuller Test

data:  oil
Dickey-Fuller = -3.0494, Lag order = 4, p-value = 0.1493
alternative hypothesis: stationary

> adf.test(diff(oil))

        Augmented Dickey-Fuller Test

data:  diff(oil)
Dickey-Fuller = -5.2575, Lag order = 3, p-value = 0.01
alternative hypothesis: stationary

 警告メッセージ: 
In adf.test(diff(oil)) : p-value smaller than printed p-value

> d=0
> for(p in 0:2){
+ for(q in 0:2){
+ tmp <- arima(oil,order=c(p,d,q),method="ML")
+ cat("(",p,",",d,",",q,"),AIC=",tmp$aic,"\n")
+ }
+ }
( 0 , 0 , 0 ),AIC= 563.1785 
( 0 , 0 , 1 ),AIC= 503.1631 
( 0 , 0 , 2 ),AIC= 472.8882 
( 1 , 0 , 0 ),AIC= 450.9493 
( 1 , 0 , 1 ),AIC= 445.5764 
( 1 , 0 , 2 ),AIC= 443.1586 
( 2 , 0 , 0 ),AIC= 441.921 
( 2 , 0 , 1 ),AIC= 442.6476 
( 2 , 0 , 2 ),AIC= 449.0249 

> oil.2.0.0 <- arima(oil,order=c(2,0,0),method="ML")
> oil.2.0.2 <- arima(oil,order=c(2,0,2),method="ML")
> oil.1.0.1 <- arima(oil,order=c(1,0,1),method="ML")

> plot(oil,main="Crued Oil Price(WTI)",xlab="date",ylab="$/bbl",ylim=c(0,150))
> par(new=T)
> plot(oil-oil.2.0.2$resid,main="",xlab="",ylab="",ylim=c(0,150),col=3)
> par(new=T)
> plot(oil-oil.2.0.0$resid,main="",xlab="",ylab="",ylim=c(0,150),col=2)
> par(new=T)
> plot(oil-oil.1.0.1$resid,main="",xlab="",ylab="",ylim=c(0,150),col=4)

> oil.2.0.0

Call:
arima(x = oil, order = c(2, 0, 0), method = "ML")

Coefficients:
         ar1      ar2  intercept
      1.3250  -0.4419    88.5246
s.e.  0.1261   0.1261     6.5043

sigma^2 estimated as 40.52:  log likelihood = -216.96,  aic = 441.92

> oil.2.0.2

Call:
arima(x = oil, order = c(2, 0, 2), method = "ML")

Coefficients:
         ar1     ar2     ma1     ma2  intercept
      0.1593  0.6191  1.0273  0.2638    88.8823
s.e.     NaN     NaN     NaN  0.1220     7.7238

sigma^2 estimated as 42.64:  log likelihood = -218.51,  aic = 449.02
 警告メッセージ: 
In sqrt(diag(x$var.coef)) :  計算結果が NaN になりました 

> oil.1.0.1

Call:
arima(x = oil, order = c(1, 0, 1), method = "ML")

Coefficients:
         ar1     ma1  intercept
      0.8715  0.3283    88.9556
s.e.  0.0627  0.1121     7.7632

sigma^2 estimated as 43:  log likelihood = -218.79,  aic = 445.58
 

参考文献
URL http://www.garfield.library.upenn.edu/classics1981/A1981MS54100001.pdf
URL http://en.wikipedia.org/wiki/Akaike_information_criterion

アプリケーション
R Core Team (2013). R: A language and environment for statistical computing.
R Foundation for Statistical Computing, Vienna, Austria.
URL http://www.R-project.org/.