I am working on an alogorithm in R to automatize a monthly forecast calculation. I am using, among others, the forecast(method='arima') function from the forecast package to calculate forecast. It is working very well. But for some times series some forecast are quite strange.
Please find below the code i'm using:
train_ts<- ts(values, frequency=12)
fit1 <- stl(train_ts, s.window="periodic",t.window=24, )
arima <- forecast(fit1,h=forecasthorizon,method ='arima')
values <- c(27, 27, 7, 24, 39, 40, 24, 45, 36, 37, 31, 47, 16, 24, 6, 21, 35, 36, 21, 40, 32, 33, 27, 42, 14, 21, 5, 19, 31, 32, 19, 36, 29, 29, 24, 42, 15, 24, 21)
Here, on the graph, you will see the historical data (black), the fitted value (green) and the forecast(blue). The forecast is not in lines with the fitted value.
As you can see the Forecast is not in line with the history, My question is "does a setup for Arima to bound the forecast in line with the history exist" ?