add_timesteps: Add timesteps

Description Usage Arguments Value

View source: R/preprocessing.R

Description

For lstm, when the number of time steps (i.e. number of lags) is defined, for each input variable, the required number of lagged values needs to be added as inputs to the input matrix

When the ts is seasonal with periodicity = 12, then lag_setting should be 12. The volume of the same month of previous year will most likely have a high influence on today's volume. When the ts is non-seasonal, lag_setting = 1, i.e. the volume of previous month will most likely have the strongest impact on today.

When lag_setting = 12 and tsteps < lag_setting (e.g. tsteps=4), then input values will be: t-12, t-11, t-10, t-9. When lag_setting = 12 and tsteps = lag_setting, then input values will be: t-12, t-11, ... , t-1. When lag_setting = 12 and tsteps > lag_setting (e.g. tsteps = 15), then input values will be: t-15, ... , t-12, ... , t-1.

Same goes for lag_setting other than 12.

Usage

1
2
3
4
5
6
7
8
add_timesteps(
  data_df,
  fc_horizon = 12,
  valid_set_size = 12,
  tsteps = 12,
  lag_setting = 12,
  ...
)

Arguments

data_df

A 'data.frame' object

fc_horizon

An integer, the forecasting horizon (i.e. the number of periods to forecast)

valid_set_size

An integer, the validation set size (default = 0)

tsteps

An integer, the number of time steps (i.e. lags) with explanatory power. These will be included as regressors.

lag_setting

An integer, the periodicity of the data. Important when dealing with seasonal data.

...

Additional arguments to be passed to the function

Value

A data.frame object


xavierkamp/tsForecastR documentation built on Feb. 1, 2020, 10:16 a.m.