Description Usage Arguments Value Examples
View source: R/VISUALIZE_plot_xreg.R
plot_xreg
is a function to create a plot which compares selected
external regressors with the variable of interest
1 | plot_xreg(main_forecasting_table, xreg = "")
|
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 vector that contains strings with the names of the external regressors to be plotted. |
A plotly object displaying multiple plots.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 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,
fc_methods = c("linear")
) %>%
dplyr::filter(grouping == "state = New York & oil_company = CompanyA") %>%
plot_xreg(
xreg = "spotprice"
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.