When performing forecasting with the forecast_ts() function, if the predictions are outside the range of the original values they will not be seen in the plot. This is due to the order of the plot + line calls: the plot function is called first on the original time series, and afterwards the predictions are added on top of that plot with the lines function. It is common to find this scenario when the original time series does not have large variations, and so the forecasting can be outside this range. This behaviour can be misleading, because the forecasting is made, but in the plot it looks like the model didn't do anything.
To fix this, instead of plotting the original time series without taking into account the predictions, the frame should be built based on the range of values of both the prediction and the forecasting.
When performing forecasting with the
forecast_ts()
function, if the predictions are outside the range of the original values they will not be seen in the plot. This is due to the order of theplot
+line
calls: the plot function is called first on the original time series, and afterwards the predictions are added on top of that plot with thelines
function. It is common to find this scenario when the original time series does not have large variations, and so the forecasting can be outside this range. This behaviour can be misleading, because the forecasting is made, but in the plot it looks like the model didn't do anything.To fix this, instead of plotting the original time series without taking into account the predictions, the frame should be built based on the range of values of both the prediction and the forecasting.
A couple of plots illustrating the issue:
Current plot:![imagen](https://user-images.githubusercontent.com/22857698/166688736-64785b8b-76d5-4286-abcf-dc740991fbb9.png)