This function computes the sensitivity of a forecasted time series (y) to small perturbations in an external regressor (xreg) using the dynrmf function.

dynrmf_sensi(y, xreg, h = NULL, level = 99, zero = 1e-04, ...)

Arguments

y

A univariate time series object to forecast.

xreg

A time series of external regressors (same length as y).

h

Forecast horizon (length of test set). If NULL, uses length of xreg.

level

Confidence level for dynrmf (default 99).

zero

Small positive constant to avoid division by zero (default 1e-4).

...

Additional parameters to be passed to ahead::dynrmf

Value

A list containing:

effects_mean

Sensitivity effects on the mean forecast.

forecast_central

Forecast without xreg.

forecast_with_xreg

Forecast with xreg.

forecast_plus

Forecast with positive perturbation on xreg.

forecast_minus

Forecast with negative perturbation on xreg.

h

Forecast horizon used.

xreg_test

Test set of xreg used in forecasting.

hh

Perturbation applied to xreg.

split

List with training and testing sets of y.

Examples


sensitivity_results_auto <- ahead::dynrmf_sensi(
  y = fpp2::uschange[, "Consumption"],
  xreg = fpp2::uschange[, "Income"],
  h = 10
)

plot1 <- ahead::plot_dynrmf_sensitivity(sensitivity_results_auto, 
                          title = "Sensitivity of Consumption to Income",
                          y_label = "Effect (ΔConsumption / ΔIncome)")
print(plot1)
#> Warning: conversion failure on 'Effect (ΔConsumption / ΔIncome)' in 'mbcsToSbcs': dot substituted for <ce>
#> Warning: conversion failure on 'Effect (ΔConsumption / ΔIncome)' in 'mbcsToSbcs': dot substituted for <94>
#> Warning: conversion failure on 'Effect (ΔConsumption / ΔIncome)' in 'mbcsToSbcs': dot substituted for <ce>
#> Warning: conversion failure on 'Effect (ΔConsumption / ΔIncome)' in 'mbcsToSbcs': dot substituted for <94>
#> Warning: conversion failure on 'Effect (ΔConsumption / ΔIncome)' in 'mbcsToSbcs': dot substituted for <ce>
#> Warning: conversion failure on 'Effect (ΔConsumption / ΔIncome)' in 'mbcsToSbcs': dot substituted for <94>
#> Warning: conversion failure on 'Effect (ΔConsumption / ΔIncome)' in 'mbcsToSbcs': dot substituted for <ce>
#> Warning: conversion failure on 'Effect (ΔConsumption / ΔIncome)' in 'mbcsToSbcs': dot substituted for <94>