rt_ts_lm_build_formula: returns a forumla string to pass 'tslm()"

View source: R/times_series.R

rt_ts_lm_build_formulaR Documentation

returns a forumla string to pass 'tslm()“

Description

returns a forumla string to pass 'tslm()“

Usage

rt_ts_lm_build_formula(
  dependent_variable,
  independent_variables = NULL,
  interaction_variables = NULL,
  ex_ante_forecast_horizon = NULL
)

Arguments

dependent_variable

name of the depedent variable in the dataset

independent_variables

name of the indepedent variables in the dataset (including "trend" & "season" if applicable)

interaction_variables

not supported yet

ex_ante_forecast_horizon

is used when the regression model will be used to forecast future values, 'ex_ante_forecast_horizon' specifies the number periods (i.e. horizon) that will be forecasted.

Ex ante means the forecast will be a "true" forecast and, in this case, will only use lagged values that are lagged far enough back, that we can use them to predict into the future. (and/or trend/season variables) For example, if we want to lag 4 periods (e.g. quarters) ahead, we must use values that are lagged 4 periods behind.

Lagged variables must be in the for of 'x_lag_y', where 'x' is the original variable name and 'y' is the lag number.

If 'ex_ante_forecast_horizon' is set, only variables that are in the form of 'x_lag_y' will be included, and additionally, only lagged variables where 'y' >= 'ex_ante_forecast_horizon' will be included.

All independent variables are included of 'ex_ante_forecast_horizon' is 'NULL'

Examples


rt_ts_lm_build_formula(dependent_variable = 'dataset',
                       independent_variables = c('trend', 'season'))


shane-kercheval/rtools documentation built on July 7, 2022, 8:31 a.m.