# How do I tell that my time series is stationary or not?

I am new to time series analysis and I am trying to model a time series. I know there are similar questions but I could not figure out the solution to my problem.

I have a time series like the one below (Blue color).

To remove the trend I fitted a polynomial curve of degree 6. As can be seen in the above picture with the red line. Then I took differences of actual to the fitted line to get the below figure (left).

Similarly, to remove the trend (other way), I took difference of lag=1 for the original time series and I observed as above (right).

Then I carried out Dickey-Fuller test for both of them, I observed this.

1. Regression Model

5%: -2.867 10%: -2.570 1%: -3.442

1. Difference model.

5%: -2.867 10%: -2.570 1%: -3.443

The statistic for the above two says that the series is stationary. But, visually we can see both the observed series are not stationary. It has some volatility clusters after de-trending. I also tried differencing twice still I have same problem. How do I go with this? Should I have to do more preprocessing for forecasting or shall I use models like ARCH or GARCH to model the series for variance?

• A series can be nonstationary in many ways. The ADF test only tests for one type of nonstationarity. If you reject nonstationarity with ADF test, it only means you have rejected one specific type of nonstationarity (i.e. unit root). But that does not mean your series is stationary. – Richard Hardy Jun 21 '17 at 11:17
• Thanks Richard. Can you give me some suggestions or links that would help me to make it stationary? – Dhineshkumar Jun 21 '17 at 17:49
• @RichardHardy Suppose that I want to model the variances in the series, would you suggest me to go with ARCH or GARCH? – Dhineshkumar Jun 22 '17 at 10:05
• It depends on the data at hand. Try both and see which one produces better-behaved residuals and lower AIC, BIC values. – Richard Hardy Jun 22 '17 at 10:54
• When I tried fitting GARCH, I used ARIMA(3,0,4) to fit the differenced data for residuals and the AIC value for it is 4323.4. This is the minimum value I could achieve after fitting various models. To test for the fit, I carried out Box-Ljung test. Following is the result X-squared = 20.203, df = 30, p-value = 0.9112. But the ACF plot of the residuals shows some correlation for longer lags. – Dhineshkumar Jun 22 '17 at 11:23

You can try a Kwiatkowski-Phillips-Schmidt-Shin (KPSS) test to check if the series is stationary. This test is used by ARIMA auto.arima() function in r.

The null hypothesis for KPSS test is that the series is stationary (opposite of ADF test).

Firstly, I would suggest to take a log of the series as the size of the fluctuations is not the same at different levels. Thereafter, you can conduct the test on the series using the following r code:

kpss.test(tseries)


If the p-value is greater than 0.05 then your series is stationary, otherwise keep differencing further.

Please refer to the following link from the book Forecasting: principles and practice by Rob Hyndman & George Athana­sopou­los for further clarification.

https://www.otexts.org/fpp/8/1

• Thanks for the link Amol. I tried applying log function to the series and I found that the variance of the values is not getting smoothened even after log transformation. Moreover, I find some -infinity values after applying log, hence I could not carry out KPSS test. – Dhineshkumar Jun 22 '17 at 9:48
• On the other hand, If I do KPSS test on first difference series, The p-value is 0.1. Does that mean the differenced series is stationary? – Dhineshkumar Jun 22 '17 at 9:57
• @DineshKumar, -infinity might be due to some values being zero or negative. You could try a log (x + min(series)) transformation. KPSS test can be carried out on this transformation. The p-value of 0.1 > 0.05, hence the series is stationary. – Amol Modi Jun 23 '17 at 9:27