# How to make a time series stationary?

Besides taking differences, what are other techniques for making a non-stationary time series, stationary?

Ordinarily one refers to a series as "integrated of order p" if it can be made stationary through a lag operator $(1-L)^P X_t$.

-

De-trending is fundamental. This includes regressing against covariates other than time.

Seasonal adjustment is a version of taking differences but could be construed as a separate technique.

Transformation of the data implicitly converts a difference operator into something else; e.g., differences of the logarithms are actually ratios.

Some EDA smoothing techniques (such as removing a moving median) could be construed as non-parametric ways of detrending. They were used as such by Tukey in his book on EDA. Tukey continued by detrending the residuals and iterating this process for as long as necessary (until he achieved residuals that appeared stationary and symmetrically distributed around zero).

-

I still think using the % change from one period to the next is the best way to render a non-stationary variable stationary as you first suggest. A transformation such as a log works reasonably well (it flattens the non-stationary quality; but does not eliminate it entirely).

The third way is to deseasonalize and de-trend the data simultaneously in one single linear regression. One independent variable would be trend (or time): 1, 2, 3, ... to how many time period you have. And, the other variable would be a categorical variable with 11 different categories (for 11 out of the 12 months). Then, using the resulting coefficient from this regression you can simultaneously detrend and de-seasonalize the data. You will see your whole data set essentially flattened. The remaining differences between periods will reflect changes independent from both growth trend and season.

-
can you explain the coefficient thing a little more elaborate for beginners? I feel your approach is worth a try because if I difference logs in my case (growth rates) the trend flattens but seasonality becomes strong. Thus the simulateneous approach seems worth trying. But what do I do with the two coefficients? in particular i mean the dummies... – hans0l0 Mar 8 '11 at 20:28
ran2, I know it may not be that clear, but I can't explain it that much better than I have already. It is a reflection of my own communication skills more than anything. Instead, I would suggest the basic fix that works more often than not. That is to simply change your nominal time series variable into a % change from one period to the next and so on. Focusing on % change instead of nominal values immediately changes a non-stationary variable into a stationary one that you can then readily regress. – Sympa Mar 10 '11 at 5:02

Logs and reciprocals and other power transformations often yield unexpected results.

As for detrending residuals(ie Tukey), this may have some application in some cases but could be dangerous. On the other hand, detecting level shifts and trend changes are systematically available to researchers employing intervention detection methods. Since a level shift is the difference of a time trend just as a pulse is the difference of a level shift the methods employed by Ruey Tsay are easily covered by this problem.

If a series exhibits level shifts (ie change in intercept) the appropriate remedy to make the series stationary is to "demean" the series. Box-Jenkins errored critically by assuming that the remedy for non-stationarity was a differencing operators. So, sometimes differencing is appropriate and other times adjusting for the mean shift"s" is appropriate. In either case, the autocorrelation function can exhibit non-stationarity. This is a symptom of the state of the series(ie stationary or non-stationary). In the case of evidented non-stationarity the causes can be different. For example, the series has truly a continuous varying mean or the series has had a temporary change in mean.

The suggested approach was first proposed Tsay in 1982 and has been added to some software. Researchers should refer to Tsay's Journal of Forecasting article titled "Outliers, Level Shifts, and Variance Changes in Time Series " , Journal of Forecasting, Vol. 7, I-20 (1988).

As usual, textbooks are slow to incorporate leading edge technology, but this material can be referenced in the Wei book (ie Time Series Analysis), Delurgio and Makradakis cover the incorporating interventions, but not how to detect as Wei's text does.

-
+1 For bringing in new ideas (with references). – whuber Mar 3 '11 at 17:51

Difference with another series. i.e. Brent oil prices are not stationary, but the spread brent-light sweet crude is. A more risky proposition for forecasting is to bet on the existence of a co integration relationship with another time series.

-

Could you fit a loess/spline through the data and use the residuals? Would the residuals be stationary?

Seems fraught with issues to consider, and perhaps there would not be as clear an indication of an overly-flexible curve as there is for over-differencing.

-
+1 for stating the solution that is obvious and yet grossly under-discussed. Every method is fraught with issues, but nonparametric smoothing is fundamental and there needs to be a good exploration of how all other proposed detrending methods relate to this one. Would be pleased to hear of relevant sources ... – zkurtz Aug 20 '14 at 15:38