Skip to content
Rebecca Pontes Salles edited this page Jun 23, 2018 · 11 revisions

Build Status codecov cran version downloads Research software impact

TSPred Package for R : Functions for Benchmarking Time Series Prediction

Current Version: 4.0 Date: 2018-06

Authors: Rebecca Pontes Salles (rebeccapsalles@acm.org) and Eduardo Ogasawara (eogasawara@ieee.org)

Description: Functions for time series preprocessing, decomposition, prediction and accuracy assessment using automatic linear modelling. The generated linear models and its yielded prediction errors can be used for benchmarking other time series prediction methods and for creating a demand for the refinement of such methods. For this purpose, benchmark data from prediction competitions may be used.

Available at CRAN: https://CRAN.R-project.org/package=TSPred

Reference manual: TSPred.pdf

Acknowledgements: The authors thank CNPq for partially sponsoring this work.


Usage:

#Install TSPred package
> install.packages("TSPred")

#Load TSPred package
> library("TSPred")

Most important functions:

Fittest linear models:

  • fittestLM - Automatically finding fittest linear model for prediction.
  • fittestArima - Automatic ARIMA fitting, prediction and accuracy evaluation.
  • fittestArimaKF - Automatic ARIMA fitting and prediction with Kalman filter.
  • fittestPolyR - Automatic fitting and prediction of polynomial regression.
  • fittestPolyRKF - Automatic fitting and prediction of polynomial regression with Kalman filter.

Automatic preprocessing/decomposition and prediction:

  • fittestMAS - Automatic prediction with moving average smoothing.
  • fittestWavelet - Automatic prediction with wavelet transform.
  • fittestEMD - Automatic prediction with empirical mode decomposition.

Examples:

Fittest linear model:

> data(CATS,CATS.cont)
> fittest <- fittestLM(CATS[,1],CATS.cont[,1])
#fittest model information
> fittest$rank[1,]
#predictions of the fittest model
> fittest$ranked.results[[1]]$pred

ARIMA fitting and prediction:

1 - Single univariate time series:
> data(SantaFe.A)
> arimapred(SantaFe.A[,1],n.ahead=100)
2 - Allowing the prediction of multiple univariate time series:
> data(NN3.A,NN3.A.cont)
> marimapred(NN3.A,NN3.A.cont,plot=TRUE)
3 - Time series interpolation:
> data(CATS)
> arimainterp(CATS[,c(2:3)],n.ahead=20,extrap=TRUE)
4 - Automatic fitting, prediction and accuracy evaluation:
> data(CATS,CATS.cont)
> fArima <- fittestArima(CATS[,1],CATS.cont[,1])
#predicted values
> pred <- fArima$pred$mean
#model information
> cbind(AICc=fArima$AICc, AIC=fArima$AIC, BIC=fArima$BIC, logLik=fArima$logLik, MSE=fArima$MSE, NMSE=fArima$NMSE, MAPE=fArima$MSE, sMAPE=fArima$MSE, MaxError=fArima$MaxError)
5 - Automatic fitting with Kalman filter, prediction and accuracy evaluation:
> data(CATS,CATS.cont)
> fArimaKF <- fittestArimaKF(CATS[,2],CATS.cont[,2])
#predicted values and estimated standard errors
> pred <- fArimaKF$pred

Polynomial regression fitting and prediction:

1 - Automatic fitting, prediction and accuracy evaluation:
> data(CATS,CATS.cont)
> fPolyR <- fittestPolyR(CATS[,3],CATS.cont[,3])
#predicted values
> pred <- fPolyR$pred
2 - Automatic fitting with Kalman filter, prediction and accuracy evaluation:
> data(CATS,CATS.cont)
> fPolyRKF <- fittestPolyRKF(CATS[,1],CATS.cont[,1])
#predicted values
> pred <- fPolyRKF$pred

Automatic moving average smoothing and ARIMA prediction:

> data(CATS,CATS.cont)
> fMAS <- fittestMAS(CATS[,1],h=20,model="arima")
#automatically selected order of moving average
> mas.order <- fMAS$order

Automatic wavelet transform and ARIMA prediction:

> data(CATS,CATS.cont)
> fW <- fittestWavelet(CATS[,1],h=20,model="arima")
#plot wavelet transform/decomposition
> plot(fW$WT)

Automatic empirical mode decomposition and VAR prediction:

> data(CATS,CATS.cont)
> femd <- fittestEMD(CATS[,1],h=20)

Developed Baseline Evaluation Processes:

The TSPred R-Package enables the evaluation of time series prediction methods against ARIMA. ARIMA establishes a baseline linear prediction model that can be consistently used to compare with several other machine learning methods. In order to aid such comparison, we have included some benchmark prediction competition datasets. Some of the cited evaluation processes with respect to 5 of the most important time series prediction competitions organized so far are presented in the following.

These competitions were adopted as they maintain their datasets and results available, besides making accessible the papers of a large number of competitors, which describe their applied methods. The works presented in them comprehend a large variety of machine learning methods, which demonstrate great efforts done by the community of scientists on the time series prediction problem through years.

Furthermore, all the selected competitions provide free and easy access to the performance evaluation metrics used, as well as the ranked prediction errors found by each of their 125 competitors. This enabled us to compare the prediction errors and performance of the competitors’ methods against the baseline. Thus, the test and analysis of prediction results are facilitated.

These selected benchmarks differ from each other in many aspects, such as the number of time series and their length, number of observations to be predicted, seasonality, missing data, prediction error metrics, etc.


Developed Review of Nonstationary Time Series Transformation Methods:

Starting from version 4.0, the TSPred R-Package provides functions for addressing nonstationarity in time series. These functions implement several transformation methods which are known for aiding the prediction of nonstationary time series. Using ARMA as a baseline prediction model, TSPred enables the comparative analysis of the effects of each implemented nonstationary time series transformation method to the problem of time series prediction.

Datasets, code and results of a thorough experiment for reviewing nonstationary time series transformation methods using the functions available in TSPred are presented in the page:

An Experimental Review of Nonstationary Time Series Transformation Methods

Clone this wiki locally
You can’t perform that action at this time.