- FastForecast
- 1 Installation
- 2 Functions
- 2.1 Time-Series transformation
- 2.2 Atypical Points Correction
- 2.3 Seasonality Detection
- 2.4 Seasonality Correction
- 2.5 Seasonality Verification
- 2.6 Stationarity Treatment
- 2.7 Aligning Time-Series length
- 2.8 Creating a dataframe with each time-series
- 2.9 Variables Selection
- 2.10 Econometrics Forecasting Models
- 2.11 Machine-Learning Forecasting Models
The goal of FastForecast is to provide a fast and accurate forecasting method for time series data. This package takes a dataframe of several time series as input, and can correct for atypical points, seasonality and stationarity. It then generates forecasting models using 6 econometric models and 6 Machine-Learning models. It also allows you to display series graphically, calculate forecast quality indicators and display them in table form as well as graphically.
You can install the development version of FastForecast from GitHub with:
# install.packages("devtools")
devtools::install_github("NoaLRX/FastForecast")
help(package="FastForecast")
# Get the list of functions available from the package
ls("package:FastForecast")
Here are the different functions that you can use in this package.
library(FastForecast)
ts_transfo <- function(DATAFRAME, YEAR, MONTH, FREQUENCY)
This function transforms the
Each time series will take the name "ts_"
followed by the name of the
column in the dataframe.
To use this function you need to pass a dataframe as the first argument, a year, month and frequency as the last argument.
For example:
ts_transfo(land_w, 2013, 01, 4) # Start the 1st January 2013, with quarterly data
ts_transfo(land_w, 1996, 05, 12) # Start the 5 May 1996, with monthly data
This function takes no argument, and will correct your previously
created time-series and correct any atypical points. This function use
the tso()
function from the package
tsoutliers.
library(tsoutliers)
atypical_tso()
This function takes no argument, and will detect any seasonality on
your previously created time-series. This function use the
combined_test()
and seasdum()
functions from the package
seastests.
library(seastests)
seaso_detect()
This function takes no argument, and will correct any seasonality on
your previously created time-series. This function use the stl()
function from the package
stats.
library(stats)
seaso_correct()
This function takes no argument, and will detect any seasonality on
your previously created and corrected time-series. This function use the
combined_test()
and seasdum()
functions from the package
seastests.
The main purpose of this function is to ensure that there is no seasonality in the corrected series.
library(seastests)
seaso_verif()
This function takes no argument, and will detect and correct, if
necessary, the time series that are not stationary. The function detect
stationarity with the adf.test()
function from the package
tseries.
library(tseries)
statio()
If after a first differentiation, the time-serie is still not stationary, the function will differentiate a second time. If after that, the time serie is still not stationary, the function will print a message and stop any treatment.
This function takes no argument, and will align your corrected time series that may have different length, because of differentiations.
allign_ts()
This function takes one argument, the
This function will create a single data frame results_df
with each
time series as columns, with the
create_df("my_Y_variable")
This function uses two methods of variables selections. The first is the “BestSubSet” method from the leaps package. The second is the “Gets” method from the gets package.
This function takes one argument, the
vselec("my_Y_variable")
After using the function, you should modify your results_df
dataframe
and remove the variables not retained by the two methods.
This function takes three arguments:
-
DATAFRAME
: Your dataframes with$n$ rows and$p$ columns (with$n > p$ ) -
Y_VARIABLE
: Your$Y_t$ variable, meaning the variable you’re trying to predict. -
PERIOD
: The frequency of your time-series (12 for monthly, 4 for quarterly…)
eco_models(df, "My_Y_Variable", 12)
eco_models(dataframe, "Gas_Price", 4)
This function uses the following models and packages:
-
ARX model with gets (gets)
-
ARX moddel with auto.arima (forecast)
-
ARMAX model with auto.arima (forecast)
-
Naive model (forecast)
-
LM model (stats)
-
AR1 mode (forecast)
-
GAM model (mgcv)
This function takes three arguments:
-
DATAFRAME
: Your dataframes with$n$ rows and$p$ columns (with$n > p$ ) -
Y_VARIABLE
: Your$Y_t$ variable, meaning the variable you’re trying to predict.
ml_models(df, "My_Y_Variable")
This function uses the following models and packages: