Demonstrates how to apply exact Shapley values to explain time-series forecasts using the `ahead::dynrmf` model with external regressors in R. Using the `uschange` dataset (US macroeconomic variables), the tutorial shows how to compute and visualize Shapley value waterfall plots across four economic scenarios (baseline, pessimistic, optimistic, overly optimistic) by varying Income and Savings regressors. The approach works because exact Shapley values are computationally feasible when the number of external regressors is small (fewer than 15). A key validation check confirms that Shapley value sums equal the difference between predictions and baseline forecasts.

3m read timeFrom r-bloggers.com
Post cover image
Table of contents
Related

Sort: