View source: R/EconometricsFunctions.R
TimeSeriesDataPrepare | R Documentation |
TimeSeriesDataPrepare is a function that takes raw data and returns the necessary time series data and objects for model building. It also fills any time gaps with zeros. Use this before you run any time series model functions.
TimeSeriesDataPrepare(
data,
TargetName,
DateName,
Lags,
SeasonalLags,
MovingAverages,
SeasonalMovingAverages,
TimeUnit,
FCPeriods,
HoldOutPeriods,
TSClean = TRUE,
ModelFreq = TRUE,
FinalBuild = FALSE
)
data |
Source data.table for forecasting |
TargetName |
Name of your target variable |
DateName |
Name of your date variable |
Lags |
The max number of lags you want to test |
SeasonalLags |
The max number of seasonal lags you want to test |
MovingAverages |
The max number of moving average terms |
SeasonalMovingAverages |
The max number of seasonal moving average terms |
TimeUnit |
The level of aggregation your dataset comes in. Choices include: 1Min, 5Min, 10Min, 15Min, and 30Min, hour, day, week, month, quarter, year |
FCPeriods |
The number of forecast periods you want to have forecasted |
HoldOutPeriods |
The number of holdout samples to compare models against |
TSClean |
TRUE or FALSE. TRUE will kick off a time series cleaning operation. Outliers will be smoothed and imputation will be conducted. |
ModelFreq |
TRUE or FALSE. TRUE will enable a model-based time frequency calculation for an alternative frequency value to test models on. |
FinalBuild |
Set to TRUE to create data sets with full data |
Time series data sets to pass onto auto modeling functions
Adrian Antico
## Not run:
data <- data.table::fread(
file.path(PathNormalizer(
"C:\\Users\\aantico\\Documents\\Package\\data"),
"tsdata.csv"))
TimeSeriesDataPrepare(
data = data,
TargetName = "Weekly_Sales",
DateName = "Date",
Lags = 5,
MovingAverages,
SeasonalMovingAverages,
SeasonalLags = 1,
TimeUnit = "week",
FCPeriods = 10,
HoldOutPeriods = 10,
TSClean = TRUE,
ModelFreq = TRUE,
FinalBuild = FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.