Since I just started getting familiar with forecasting, so I stumbled upon the example
To forecast 5 years you can use h
to set the number of forecasts:
autoplot(lungDeaths)
geom_forecast(h = 60, showgap = FALSE)
Output:
To remove the confidence intervals use PI
:
If FALSE, confidence intervals will not be plotted, giving only the forecast line.
library(forecast)
autoplot(lungDeaths)
geom_forecast(h = 60, showgap = FALSE, PI = FALSE)
Output: