# Transforming a time series so it is stationary

I am not sure if I am undertaking the following steps correctly. I am trying to make this time series stationary: as you can see, it is decreasing:

In the beginning I tried taking log, but it is still decreasing:

Then I take differences, but still it doesn't look stationary to me:

Did I do anything wrong? What can I do to make it stationary? I need it to be stationary to use ACF and PACF.

• You can't make a time series stationary if it isn't stationary. You can, of course, treat a time series as stationary regardless of what the data look like, but if your predictions and inferences turn out to be way off, then the data is hinting to you that maybe you should not be having too much confidence in your confidence intervals because you are jumping to false conclusions from dubious premises. Alternatively, just change the scale on the vertical axis so that each division corresponds to 100 instead of 10 as you have it now, and you will see that your graph looks pretty stationary! Feb 19, 2016 at 23:45
• @DilipSarwate Yeah, you are right, sorry for my bad wording. Feb 20, 2016 at 0:19

Clearly, like Hey Lyla has pointed out, you have some seasonality in there. I would suggest you try to include $11$ monthly dummy variables for the first $11$ months. (Do not include $12$, since you will run into the dummy variable trap else.) I Then you can seasonally adjust the data by substracting the fitted model's monthly dummies from the actual data. This might do the job.

Alternatively, you could consider applying a Fourier Transformation (essentially fitting sine/cosine curves) and substracting the corresponding coefficients instead. The number of expansion terms (i.e., sine/cosine functions) can be determined with information criteria like AIC or BIC.

Edit: As pointed out by Richard Hardy in the comments, if you suspect any kind of deterministic time trend to be present in the data, you should also include an appropriate regressor (in your case potentially one for a linear trend). Note that you will still only have to substract the monthly dummies.

• If there is a linear time trend in the data which is not accounted for in the model, using seasonal dummies becomes problematic. For example, if we have 60 observations of monthly data starting in January and the data has a downward linear trend, January may appear to have the largest positive seasonal effect. If we cut the first observation, February will be the one with the largest positive seasonal effect. Etc., etc. But what is driving this is the neglected deterministic time trend. At the extreme, even if there really is no seasonality, the dummies will still pick up the trend. Feb 20, 2016 at 12:47
• That is true if you don't include a linear trend, but can't that be circumvented by including a linear trend coefficient to begin with? Correct me if I'm wrong here but I would deseasonalize by only substracting the dummies, even though you have included a linear time trend in the regression. (Similarly for other deterministic trend forms.) Feb 20, 2016 at 12:56
• I think we agree. But since you did not mention including a linear trend in your answer, I warned what can happen if the answer is followed exactly. Feb 20, 2016 at 13:03
• Okay, I read my answer again and noticed that it was indeed easy to misread it - I tried to change that with a minor edit. Thanks for your help! Feb 20, 2016 at 13:08
• Looks better now. Feb 20, 2016 at 13:16

What matters if that your errors can be described by stationarity. In a statistical model the only distributional assumption is on the noise. That is the residuals from some model should be stationary and described by an appropriate probability distribution. Just plotting the data corresponds to a null model where the data themselves are in some sense residual. You could try to account for the declining mean by including some covariate(s) in a model, even if one of those covariates is simply time (e.g. a linear decline).

It looks to me your series need a seasonal adjustment. You can check if it is true from the pacf; if the series shows significant spikes regularly (for example a spikes each 12 lags) then it has seasonality issues.

• you mean i need to detrend? Feb 19, 2016 at 23:18
• No, seasonal adjustment is one thing, detrending is another. Feb 20, 2016 at 12:37

Log transform doesn't help with mean stationarity. It may help with certain kind of variance stationarity, namely when the variance is proportional to the levels.

Log-transform may help by linearizing the growth rates, e.g. $e^{\alpha x}$ will become $\alpha x$ after the log transform, which may help with modeling.

In any case you r transformation should have some purpose and correspond to the underlying process. Just randomly throwing things at the series to get the mean stabilize is not a good idea, you may mess up other characteristics.

Your series look like a candidate for threshold models with some kind of downward trend. Again, you can't simply de-trend it by using your favorite detrending function. Maybe the trend is what's most interesting in your series. There's got to be a purpose in these transformations.

• Well my purpose is to analysis this time series with acf and pacf to find the best fit ARIMA model, and use this "best" fit model to forecast, let's say next 10 values in the future. Feb 20, 2016 at 0:26
• Stationarity is not a requirement for ARIMA. In fact ARIMA is not for stationary series. The I in ARIMA means integrated, i.e. it could be difference model and if your constant is not zero, then the difference will produce the drift. Youclearly need some kind of seasonal ARIMA approach also called SARIMA sometimes Feb 20, 2016 at 0:29
• But if I want to analysis this data by using ACF or PACF, i need to transform the data into stationary, Am i right about this? Feb 20, 2016 at 0:32