This is a relatively naive Python implementation of a seasonal and trend decomposition using Loess smoothing. Commonly referred to as an "STL decomposition", Cleveland's 1990 paper is the canonical reference.
This implementation is a variation of (and takes inspiration from) the implementation of the
in statsmodels <http://www.statsmodels.org/stable/generated/statsmodels.tsa.seasonal.seasonal_decompose.html#statsmodels.tsa.seasonal.seasonal_decompose>. In this implementation, the trend component is calculated by substituting a configurable
Loess regression <https://en.wikipedia.org/wiki/Local_regression> for the convolutional method used in
seasonal_decompose. It also extends the existing
statsmodels to allow for forecasting based on the calculated decomposition.
stldecompose package is relatively lightweight. It uses
pandas.Dataframe for inputs and outputs, and exposes only a couple of primary methods -
forecast() - as well as a handful of built-in forecasting functions.
the included IPython notebook <https://github.com/jrmontag/STLDecompose/blob/master/STL-usage-example.ipynb>_ for more details and usage examples.
A Python 3 virtual environment is recommended.
The preferred method of installation is via
If you'd like the bleeding-edge version, you can also install from this Github repo::
(env) $ git clone email@example.com:jrmontag/STLDecompose.git (env) $ cd STLDecompose; pip install .
Time Series analysis <http://www.statsmodels.org/stable/tsa.html>_ package
OTexts reference on STL decomposition <https://www.otexts.org/fpp/6/5>_