Prediction intervals for Loess forecasting (simulation-based)

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::loess (Local Polynomial Regression Fitting), adapted to univariate forecasting in ahead::loessf.

Currently for this model (as of 2023-08-28), for uncertainty quantification, options are:

  • Independent bootstrap of the residuals
  • Multivariate circular block bootstrap of the residuals
  • Multivariate moving block bootstrap of the residuals
  • Adjustment of a copula to the residuals
  • More options to come in the future.

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(datasets)

ahead::loessf on Nile dataset

plot(loessf(Nile, h=20, 
            type_pi = "bootstrap",
            type_aggregation = "mean",
            level=95, B=10))

plot(loessf(Nile, h=20, 
            type_pi = "bootstrap",
            type_aggregation = "median",
            level=95, B=10))

plot(loessf(Nile, h=20, 
            type_pi = "blockbootstrap",
            type_aggregation = "mean",
            level=95, B=10))

plot(loessf(Nile, h=20, 
            type_pi = "blockbootstrap",
            type_aggregation = "median",
            level=95, B=10))