Description Usage Arguments Value Examples
View source: R/POST_FORECAST_get_fitted_tree_forest_values.R
get_fitted_tree_forest_values
is a function that creates fitted values
from the tree and forest forecast models. The fitted values vary with respect
to one changing external regressor.
1 2 3 4 5 | get_fitted_tree_forest_values(
main_forecasting_table,
main_fit_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 |
main_fit_table |
A tibble containing information about the specific fc_model and external regressor values to be used as inputs |
xreg |
A character that contains a string with the name of the external regressor to be plotted. |
A vector of fitted values
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | main_forecasting_table <- 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) %>%
dplyr::filter(grouping == "state = New York & oil_company = CompanyA") %>%
add_fc_models_to_main_forecasting_table(
periods_ahead = 12,
fc_methods = c("tree", "forest"),
keep_fc_model_objects = T
)
fc_models <- names(main_forecasting_table$fc_models[[1]])
main_fit_table <- tibble::tibble(
xreg_value = vector(length = 100 * length(fc_models)),
fitted = vector(length = 100 * length(fc_models)),
fc_model = rep(fc_models, each = 100)
)
get_fitted_tree_forest_values(
main_forecasting_table = main_forecasting_table,
main_fit_table = main_fit_table,
xreg = "spotprice"
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.