Explaining Time-Series Forecasts with Sensitivity Analysis (ahead::dynrmf and external regressors)

Wait 5 sec.

[This article was first published on T. Moudiki's Webpage - R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.Following the post on exact Shapley values for time series explainability, this post illustrates an example of how to use sensitivity analysis to explain time-series forecasts, based on the ahead::dynrmf model and external regressors. What is sensitivity analysis in this context? It’s about evaluating the impact of changes in the external regressors on the time-series forecast.The post uses the ahead::dynrmf_sensi function to compute the sensitivities, and the ahead::plot_dynrmf_sensitivity function to plot the results.First, install the package:devtools::install_github("Techtonique/ahead")Then, run the following code:# devtools::install_github("Techtonique/ahead")# install.packages(c("fpp2", "e1071", "patchwork"))library(ahead)library(fpp2)library(patchwork)library(e1071)#' # Example 1: US Consumption vs Incomesensitivity_results_auto