Plots a historical series (either the total series or a chosen bottom-level series of a hierarchical time series) alongside its point forecast, mean forecast (from simulations), and prediction interval, as produced by a hierarchical forecasting routine. A vertical line marks the train/test split point.

plot_hts_forecast(result, hts, series_type = "total", series_idx = 1)

Arguments

result

a list containing forecast results, with elements point_forecasts (list with total and bottom components), mean_forecasts (list with total and bottom components), prediction_intervals (list with total, a matrix with columns "lower"/"upper", and bottom, a list with lower and upper matrices, one column per bottom series), and split_info (list with split_point and alpha)

hts

a hierarchical time series object containing total (the historical total series) and bts (a matrix of historical bottom-level series, one column per series)

series_type

character string; either "total" to plot the total series, or any other value to plot a bottom-level series (default "total")

series_idx

integer; index of the bottom-level series to plot when series_type != "total" (default 1)

Value

No return value; called for the side effect of producing a plot

Author

T. Moudiki

Examples


# plot_hts_forecast(result, hts, series_type = "total")
# plot_hts_forecast(result, hts, series_type = "bottom", series_idx = 2)