get_data_forecast: Set up data for explain_forecast

View source: R/explain_forecast.R

get_data_forecastR Documentation

Set up data for explain_forecast

Description

Set up data for explain_forecast

Usage

get_data_forecast(
  y,
  xreg,
  train_idx,
  explain_idx,
  explain_y_lags,
  explain_xreg_lags,
  horizon
)

Arguments

y

A matrix or numeric vector containing the endogenous variables for the model. One variable per column, one observation per row.

xreg

A matrix containing exogenous regressors for the model. One variable per column, one observation per row. Should have nrow(data) + horizon rows.

train_idx

The observations indices in data to use as training examples.

explain_idx

The observations indices in data to explain.

explain_y_lags

Numeric vector Indicates the number of lags of y to include in the explanation.

explain_xreg_lags

Numeric vector Indicates the number of lags of xreg to include in the explanation.

horizon

The forecast horizon to explain.

Value

A list containing

  • The data.frames x_train and x_explain which holds the lagged data examples.

  • A numeric, n_endo denoting how many columns are endogenous in x_train and x_explain.

  • A list, group with groupings of each variable to explain per variable and not per variable and lag.


NorskRegnesentral/shapr documentation built on April 19, 2024, 1:19 p.m.