Description Usage Arguments Value Examples
View source: R/INTRA_FORECAST_add_univariate_forecast_model.R
add_univariate_forecast_model
is a function to add a single univariate
forecast model to a (named) list of forecast models. The forecast model is
created based on a model formula in conjunction with other parameters, which
is then used to forecast a specific number of periods ahead.
1 2 3 4 5 6 7 8 9 10 11 | add_univariate_forecast_model(
fc_models,
ts_object_train,
fc_name,
fc_formula,
model_fc = FALSE,
periods_ahead = 1,
periods_history = Inf,
verbose = FALSE,
log_message = ""
)
|
fc_models |
A named list of forecast models, with for each forecast model a list with the model itself and a table with forecast values. |
ts_object_train |
A time series object, which contains only the training data. |
fc_name |
A character string specifying the name to be used for the new model that is added to the list of existing forecast models. |
fc_formula |
A character string specifying the expression to be evaluated to train the time series forecast model. |
model_fc |
Boolean, which is to be set to TRUE if the forecast expression specified for fc_formula returns an object with a forecast method, or set to FALSE if the forecast expression returns a forecast directly. |
periods_ahead |
A positive integer value indicating the number of periods to forecast ahead. |
periods_history |
A positive integer value indicating the number of historic datapoints to use for training, which is only relevant for specific forecast methods such as drift and mean. |
verbose |
Boolean, which is set to TRUE if status updates are valued, or set to FALSE if they are not. |
A named list of forecast models, with for each forecast model a list with the model itself and a table with forecast values.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ts_object_train <- tstools::initialize_ts_forecast_data(
data = dummy_gasprice,
date_col = "year_month",
col_of_interest = "gasprice",
group_cols = c("state", "oil_company")
) %>%
dplyr::filter(grouping == "state = New York & oil_company = CompanyA") %>%
tstools::transform_data_to_ts_object()
add_univariate_forecast_model(
fc_models = list(),
ts_object_train = ts_object_train,
fc_name = "fc_drift_l6m",
fc_formula = "rwf(x, h, drift = TRUE)",
model_fc = FALSE,
periods_ahead = 12,
periods_history = 6,
verbose = T
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.