I am trying to make a point by point time series forecast using ARIMAAIC to determine the hyperparameters and arima for the forecast.
So I used a loop, in which I increment on each iteration the length of the train set for the arima fit.
When I ran it for 10 iterations, I had 10 warnings, each one related to the arima (here is the code)
> borne <- 9000
> train <- df[1:borne,]
>
> for (i in 1:10){
+
+ param = ARIMAAIC(train, p=5, q=5, d=0, season=list(order=c(0,0,0),period=NA),in.mean=TRUE)
+ inds = which(param == min(param), arr.ind=TRUE)
+ inds
+ p = rownames(param)[inds[,1]]
+ q = colnames(param)[inds[,2]]
+
+ q = as.numeric(substr(q, nchar(q), nchar(q)))
+ p = as.numeric(substr(p, nchar(p), nchar(p)))
+
+ fit <- arima(train, order = c(p,0,q), seasonal = list(order = c(0,0,0)))
+
+ predd = forecast(fit,h=1)
+
+ comparedf <- cbind(df[borne,1], predd$mean)
+
+ borne <- borne + 1
+ train[borne] <- df[borne,1]
+ }
Warning messages:
1: In arima(data, order = c(i, d, j), seasonal = season, include.mean = in.mean) :
possible convergence problem: optim gave code = 1
2: In arima(train, order = c(p, 0, q), seasonal = list(order = c(0, :
problème de convergence possible : optim renvoie un code = 1
3: In arima(data, order = c(i, d, j), seasonal = season, include.mean = in.mean) :
possible convergence problem: optim gave code = 1
And what I don't understand is that when I run an iteration without a loop it does not give a warning.
> borne <- 9000
> train <- df[1:borne,]
>
> param = ARIMAAIC(train, p=5, q=5, d=0, season=list(order=c(0,0,0),period=NA),in.mean=TRUE)
> inds = which(param == min(param), arr.ind=TRUE)
> inds
row col
p=3 4 4
> p = rownames(param)[inds[,1]]
> q = colnames(param)[inds[,2]]
>
> q = as.numeric(substr(q, nchar(q), nchar(q)))
> p = as.numeric(substr(p, nchar(p), nchar(p)))
>
> fit <- arima(train, order = c(p,0,q), seasonal = list(order = c(0,0,0)))
>
> predd = forecast(fit,h=1)
>
> comparedf <- cbind(df[borne,1], predd$mean)
> comparedf
Time Series:
Start = 9001
End = 9001
Frequency = 1
df[borne, 1] predd$mean
9001 0.1801373 0.2037498
There is certainly a reasonable reason but I can't find it.
Any insight or guidance would be greatly appreciated. Thank you in advance.