maxP <- 2
maxQ <- 2
AIC <- matrix(0,nrow=maxP,ncol=maxQ)
BIC <- matrix(0,nrow=maxP,ncol=maxQ)
HQC <- matrix(0,nrow=maxP,ncol=maxQ)
# Save all information criteria
for (p in 0:maxP){
for(q in 0:maxQ){
if (p>0) {ARLags <- 1:p}
else {ARLags <- 0}
if (q>0) {MALags <- 1:q}
else{MALags <- 0}
# Estimate the model
CPI_fit <- arma(CPI, order(ARLags, MALags, include.intercept = TRUE)
# Save the criteria in a P x Q matrix
AIC[p+1, q+1] <- CPI_fit$aic
BIC[p+1, q+1] <- CPI_fit$bic
}
}
AIC
BIC
我正在尝试创建一个自动程序来选择 ARMA 模型的模型规范,但我总是收到以下错误消息:
Error in if (N <= 0) NULL else seq(N) :
missing value where TRUE/FALSE needed
这是什么意思,我该如何预防?