1

我一直在研究这个程序,以获得我的时间序列数据点的最佳 ARIMA 模型。我创建了一个循环,可以通过将 arima() 函数上的参数值替换为 for () 循环值来评估不同的模型,并将参数替换为循环变量的值。

这是为了获得具有最小 AIC 或 BIC 的 arima 模型。模型开始运行良好,但是当我离开它一段时间时,它会显示此错误,我不知道它是什么意思。

我会留下代码和错误...

感谢您的帮助,希望有人可以帮助我!:)

    minimo<-5000
    prueba<-0
    arima_1<-auto.arima(ts_m_rojo)
    for (p in 0:3) {
      for (d in 0:3) {
        for (q in 0:3) {
          for (P in 0:1) {
            for (D in 0:1) {
              for (Q in 0:1) {
          for (l in 7:7) {
              prueba<-arima_1$aic
            if (minimo>prueba) {
              minimo<-prueba
              print(paste("ARIMA(",p,",",d,",",q,")",",","      (",P,",",D,",",Q,")","[",l,"]"))
          print(arima_1)
          acf(arima_1$residuals, xaxp = c(0, 120, 4), lag.max=120, main = "") 
          pacf(arima_1$residuals, xaxp = c(0, 120, 4), lag.max=120, main = "")
          }
arima_1 <- arima (ts_m_rojo, order=c(p,d,q) , 
                  seasonal= list(order=c (P,D, Q) ,period=l))
      }
          }
        }
      }
    }
  }
}


    Error in optim(init[mask], armafn, method = optim.method, hessian =            TRUE,  : 
    non-finite finite-difference value [1]
    In addition: Warning message:
    In log(s2) : NaNs produced
4

0 回答 0