時序

自動選擇 BIC 最小化 ARIMA(1,0,X) 模型

  • April 24, 2016

我想估計一個 ARIMA(1,0,X) 模型。選擇模型中的 MA(X) 以最小化 BIC。我有以下程式碼使用auto.arimaR 中“預測”包中的函式:

auto.arima(logret$appl, d=0, max.p=1, max.q=10,
max.order=NA, max.d=0,start.p=1, start.q=0,
stationary=FALSE, seasonal=FALSE,
ic=c("bic"), stepwise=TRUE, trace=TRUE,
allowdrift=TRUE, allowmean=TRUE, lambda=NULL, parallel=FALSE, num.cores=NULL)

以下是上述程式碼的結果

ARIMA(1,0,0) with non-zero mean : -6592.886
ARIMA(0,0,0) with non-zero mean : -6597.561
ARIMA(1,0,0) with non-zero mean : -6592.886
ARIMA(0,0,1) with non-zero mean : -6592.48
ARIMA(0,0,0) with zero mean     : -6604.679
ARIMA(1,0,1) with non-zero mean : -6586.55

Best model: ARIMA(0,0,0) with non-zero mean 

Series: logreturns$REL.CP 
ARIMA(0,0,0) with non-zero mean 

Coefficients:
     intercept
         0e+00
s.e.      5e-04

sigma^2 estimated as 0.0002818:  log likelihood=3305.9
AIC=-6607.81   AICc=-6607.8   BIC=-6597.56

我的問題需要保留AR(1)並保留d=0在我測試 MA 滯後的所有模型中。有沒有辦法解決 AR 滯後問題?我真正想要的是這個 arima(1,0, X) 模型中的 MA(1) 係數。謝謝

您可以手動完成。讓我們x成為數據系列。下面的程式碼考慮和之間的所有移動平均滯後階數0max.q並列印出 BIC 最小化滯後階數和相應的估計模型:

m=list() # I will save estimated ARIMA(1,0,q) models here
BIC=c()  # I will save the corresponding BIC values here
max.q=10 # the maximum MA order you want to consider
n=length(x)
for(q in 0:max.q){
m[[q+1]]=arima(x,order=c(1,0,q),method="ML")
BIC[q+1]=AIC(m[[q+1]],k=log(n))
}
print(paste("BIC-optimal MA order is",which.min(BIC)-1)) # info message
print(m[[which.min(BIC)]]) # print the estimated BIC-optimal model

編輯:

為了響應評論中的請求,我包含了一個返回估計 MA1 係數的函式:

MA1fromARIMA10q=function(x,max.q=10,...){
# x is a data vector (a time series)
# max.q is the maximum MA order to be considered
m=list() # I will save estimated ARIMA(1,0,q) models here
BIC=c()  # I will save the corresponding BIC values here
n=length(x)
for(q in 0:max.q){
 m[[q+1]]=arima(x,order=c(1,0,q),...)
 BIC[q+1]=AIC(m[[q+1]],k=log(n))
}
q=which.min(BIC)-1
if(q>0) MA1=coef(m[[q+1]])[2] else(MA1=NA) # if MA order is 0, assign NA
return(MA1)
}

引用自:https://quant.stackexchange.com/questions/25539