12
$\begingroup$

I have a long time series(data at hourly level, for 6 years). The data is showing an hourly, a weekly, a monthly as well as a yearly trend. For this data, should I try stl(Seasonal and Trend decomposition using Loess) or arima?

I am using R for analysis and have used arima in the past. But I am not sure which technique, to use in this case, considering the data has multiple level of seasonality.

My second question is more generic. Do people, working in time series forecasting, actually use stl for forecasting purpose? I, am of the opinion, that stl is a good technique for understanding the data, and arima is a better technique for forecasting. Is this understanding correct?

$\endgroup$
4
  • 3
    $\begingroup$ How exactly would you like to use STL for forecasting..? STL is a method for decomposing your data into the three components (i.e. exploratory data analysis and visualization) not for making any predictions. $\endgroup$
    – Tim
    Commented Aug 18, 2017 at 7:53
  • 2
    $\begingroup$ Exponential smoothing state space models can make use of STL trend data and can be used to predict time series by adding the last season of seasonal data. Maybe this is what you want? $\endgroup$
    – AlexR
    Commented Aug 18, 2017 at 7:57
  • 2
    $\begingroup$ Stl is not a forecasting technique, STL helps you decompose time series data into seasonal, trend and mouse components. STL as it is implemented in R does not have the ability to handle multiple seasonalities which means it is not suitable for handling hourly data. $\endgroup$
    – forecaster
    Commented Aug 18, 2017 at 10:18
  • $\begingroup$ @Tim You can use the trend and seasonal component together to generate a point forecast. Treat the remainder series as prediction error. $\endgroup$
    – user11284
    Commented Jul 2, 2019 at 2:58

1 Answer 1

15
$\begingroup$

The Forecasting: principles and practice book by Rob J. Hyndman and George Anthanasopoulos answers your question:

STL has several advantages over the classical decomposition method and X-12-ARIMA: Unlike X-12-ARIMA, STL will handle any type of seasonality, not only monthly and quarterly data. The seasonal component is allowed to change over time, and the rate of change can be controlled by the user. The smoothness of the trend-cycle can also be controlled by the user. It can be robust to outliers (i.e., the user can specify a robust decomposition). So occasional unusual observations will not affect the estimates of the trend-cycle and seasonal components. They will, however, affect the remainder component. On the other hand, STL has some disadvantages. In particular, it does not automatically handle trading day or calendar variation, and it only provides facilities for additive decompositions.

So STL can deal with phenomena such as multiple seasonalities, high-frequency seasonalities (e.g. 365 for daily data) and cycles. However if you have daily data you can go for a model which tackles the thematic of multiple seasonalities, e.g. TBATS instead of STL. If you have many multiple seasonalities and millions or billions of observations you can go for data-savvy complex models such as recurrent neural nets. STL might be a useful approach for modeling business cycles. In a business cycle not every cycle has exact the same length, but they are rather an irregularly recurring phenomenon. Sometimes recession might last 2 years and sometimes it might last 5 or 6. STL is more able to capture this kind of uncertainty than ARIMA. Also if you cannot make your data stationary STL will be more useful than ARIMA. ARIMA requires the data to be stationary or at least to be stationary in differences.

You can also take a part of your data as test set and test whether on your particular dataset STL works better than ARIMA.

STL is usually used for understanding and describing the data, but you can combine it with simple forecasting methods as described in chapter 6.6 of the book I mentioned above. These simply forecasting methods are not always "worse" than complex methods such as Auto-regressive models, neural nets or Bayesian models such as Kalman filter. You can compare them for instance by using scaled errors (e.g. MAE and RMSE) on the training and the test set of your data.

$\endgroup$
3
  • 2
    $\begingroup$ Thanks a lot @Ferdi. Nice answer. Answered a lot of my questions and doubts. $\endgroup$ Commented Aug 28, 2017 at 11:44
  • $\begingroup$ Re: multiple seasonalities, by default STL identifies only a single seasonal component, though the period (or "frequency" in the algo) can be arbitrary. However you can uncover multiple seasonalities by repeatedly decomposing the resulting trend component. I get daily + weekly by starting with a daily period and then applying a decomp with weekly period to the trend. $\endgroup$
    – user11284
    Commented Jul 2, 2019 at 2:50
  • 2
    $\begingroup$ With respect to additive decompositions, you can do a log transform on the data before running STL on it, and then backtransform the result. $\endgroup$
    – user11284
    Commented Jul 2, 2019 at 2:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.