Univariate Time Series Analysis Template

If you’re looking for a standard boilerplate to analyse univariate time-series data, this is for you!


Photo by Nicholas Cappello on Unsplash

In this post, I present standard steps that can be used for time series analysis, including application in forecasting. There are three steps that we will perform:

1. Check for Stationarity. Use 3 tests: ADF, KPSS and autocorrelation.
2. If signal is non-stationary, make it stationary. Use either transformation: Detrending, Differencing or Decomposing.
3. Performs forecasting. Use SARIMAX model.

I’ve also created a Jupyter Notebook to accompany this post here.

Check for Stationarity

Make Stationary

Forecasting using SARIMAX

With SARIMAX, we don’t need to manually perform step 2 (making signal stationary), since it is automatically done by the model.


  1. https://github.com/PacktPublishing/Mastering-Python-for-Finance-Second-Edition/tree/master/Chapter06
  2. https://github.com/PacktPublishing/Python-for-Finance-Cookbook/blob/master/Chapter%2003/chapter_3.ipynb
  3. https://analyzingalpha.com/interpret-arima-results



Edward Elson Kosasih

PhD in Operations Research and Machine Learning at University of Cambridge