Plotting functions

ahead is a package for univariate and multivariate time series forecasting, with uncertainty quantification (R and Python).

The model used in this demo is stats::ridge2f.

Please remember that in real life, this model’s hyperparameters will have to be tuned.

Install ahead

Here’s how to install the R version of the package:

  • 1st method: from R-universe

    In R console:

    options(repos = c(
        techtonique = 'https://techtonique.r-universe.dev',
        CRAN = 'https://cloud.r-project.org'))
    
    install.packages("ahead")
  • 2nd method: from Github

    In R console:

    devtools::install_github("Techtonique/ahead")

    Or

    remotes::install_github("Techtonique/ahead")

And here are the packages that will be used in this vignette:

library(ahead)
library(fpp)

Forecasting and plot predictions

obj <- ahead::ridge2f(fpp::insurance, h = 7, type_pi = "blockbootstrap", B = 10, 
                      block_length = 5)
#>   |                                                                              |                                                                      |   0%  |                                                                              |=======                                                               |  10%  |                                                                              |==============                                                        |  20%  |                                                                              |=====================                                                 |  30%  |                                                                              |============================                                          |  40%  |                                                                              |===================================                                   |  50%  |                                                                              |==========================================                            |  60%  |                                                                              |=================================================                     |  70%  |                                                                              |========================================================              |  80%  |                                                                              |===============================================================       |  90%  |                                                                              |======================================================================| 100%
plot(obj, selected_series = "Quotes", type = "sims", 
     main = "Predictive simulations \n for Quotes")

plot(obj, selected_series = "Quotes", type = "dist", 
     main = "Predictive simulation \n for Quotes")

plot(obj, selected_series = "TV.advert", type = "sims", 
     main = "Predictive simulation \n for TV.advert")

plot(obj, selected_series = "TV.advert", type = "dist", 
     main = "Predictive simulation \n for TV.advert")