Description Usage Arguments Value Examples
View source: R/VISUALIZE_plot_hierarchical_forecasts.R
plot_hierarchical_forecasts
is a function that creates a plot which
looks at how the forecasts of the chosen hierarchical group compares to it's
children, if applicable.
1 2 3 4 5 6 7 | plot_hierarchical_forecasts(
main_forecasting_table,
fc_model = c("consistent", "bottom_up"),
hierarchical_cols = "",
grouping = "",
demo_mode = FALSE
)
|
main_forecasting_table |
A tibble containing a unique value for
ts_split_date but not for the grouping column. It is assumed that this
table is created using the |
fc_model |
A string that can be either "consistent" for consistent hierarchical forecast models or "bottom_up" for bottom-up hierarchical forecast models. |
hierarchical_cols |
A string indicating which grouping columns are the hierarchical ones to be used in the plot. |
grouping |
A string indicating which grouping is the top group of the stacked plot. |
demo_mode |
Boolean, which is to be set to TRUE if any potentially sensitive figures should be hidden from the audience for demo purposes, or set to FALSE if all figures can safely be displayed. |
A plotly object displaying a stacked plot, if the selected grouping is a hierarchical parent.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | dummy_hierarchical_gasprice %>%
tstools::initialize_ts_forecast_data(
date_col = "year_month",
col_of_interest = "gasprice",
group_cols = "currency",
hierarchical_cols = c("location", "oil_company")
) %>%
dplyr::filter(period >= as.Date("2004-11-30")) %>%
create_main_forecasting_table() %>%
add_fc_models_to_main_forecasting_table(
fc_methods = c("basic", "linear")
) %>%
add_hierarchical_fc_models_to_main_forecasting_table() %>%
dplyr::filter(ts_split_date == 200611) %>%
plot_hierarchical_forecasts(
fc_model = "consistent",
hierarchical_cols = "location",
grouping = "location = USA & oil_company = CompanyC & currency = EUR"
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.