我正在使用arima函数进行日内预测。一天中每15分钟可获得一次数据。在下面的代码中,除了for循环中的一些i值之外,它工作正常。输出显示为i = 223。预测函数产生NaN值。我检查了数据集,那里没有NaN值。请建议我如何摆脱这个问题。
predict1=c()
predict2=c()
for(i in 1:456){
y1n=ts(nbl$nbp[(12385+(i-1)*4):(15356+(i-1)*4)],frequency=96)
y1n[which(is.na(y1n))]=y1n[which(is.na(y1n))-96]
arima1=arima(y1n,order=c(1,1,0),seasonal=c(2,1,1),method="CSS")
predict1=predict(arima1,8)
predict2[(((i-1)*4)+1):(((i-1)*4)+4)]=predict1$pred[5:8]
}
arima1
Call:
arima(x = y1n, order = c(1, 1, 0), seasonal = c(2, 1, 1), method = "CSS")
Coefficients:
ar1 sar1 sar2 sma1
0.0241 -0.1122 -0.1068 -0.7830
s.e. 0.0188 0.0240 0.0224 0.0189
sigma^2 estimated as 1490: part log likelihood = -14583.05
> predict1=predict(arima1,8)
> predict1
$pred
Time Series:
Start = c(31, 93)
End = c(32, 4)
Frequency = 96
[1] NaN NaN NaN NaN NaN NaN NaN NaN
$se
Time Series:
Start = c(31, 93)
End = c(32, 4)
Frequency = 96
[1] NaN NaN NaN NaN NaN NaN NaN NaN