Description Usage Arguments Value Examples
View source: R/VISUALIZE_plot_xreg_drivers.R
plot_xreg_driver
is a function to create a plot which shows how one
external regressor influences the variable of interest, ceteris paribus
1 2 3 4 5 6 | plot_xreg_drivers(
main_forecasting_table,
xreg = "",
delta = 0,
granularity = 50
)
|
main_forecasting_table |
A tibble containing a single row per group and
several columns of data required for time series forecasting, which has
been created using the |
xreg |
A character that contains a string with the name of the external regressor to be plotted. |
delta |
A numeric to look at how many deltas one wants for xreg. Applicable only in ML fc_models (e.g. trees and forests) where such deltas are taken into account when running a forecast. |
granularity |
A numeric determining how fine one wants the plot to be. Higher numbers return better resolution plots, but will also increase run time. |
A plotly object displaying how the selected xreg drivers the variable of interest.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | tstools::initialize_ts_forecast_data(
data = dummy_gasprice,
date_col = "year_month",
col_of_interest = "gasprice",
group_cols = c("state", "oil_company"),
xreg_cols = c("spotprice", "gemprice")
) %>%
create_main_forecasting_table() %>%
dplyr::filter(ts_split_date == 200503) %>%
add_fc_models_to_main_forecasting_table(
periods_ahead = 12
) %>%
dplyr::filter(grouping == "state = New York & oil_company = CompanyA") %>%
plot_xreg_drivers(
xreg = "spotprice"
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.