# Confusion with Augmented Dickey Fuller test

I am working on the data set electricity available in R package TSA. My aim is to find out if an arima model will be appropriate for this data and eventually fit it. So I proceeded as follows:

1st: Plot the time series which resulted if the following graph:

2nd: I wanted to take log of electricity to stabilize variance and afterward differenced the series as appropriate, but just before doing so, I tested for stationarity on the original data set using the adf (Augmented Dickey Fuller) test and surprisingly, it resulted as follows:

### Code and Results:

adf.test(electricity)

Augmented Dickey-Fuller Test
data:  electricity
Dickey-Fuller = -9.6336, Lag order = 7, p-value = 0.01
alternative hypothesis: stationary
Warning message: In adf.test(electricity) : p-value smaller than printed p-value


Well, as per my beginner's notion of time series, I suppose it means that the data is stationary (small p-value, reject null hypothesis of non-stationarity). But looking at the ts plot, I find no way that this can be stationary. Does anyone has a valid explanation for this?

• ADF only tests for unit root stationary, this could be trend stationary. So you should use the KPSS test, see stats.stackexchange.com/questions/30569/… In general, there is a difference, between DS (difference-stationary) and TS (trend stationary) models. KPSS is the better test to distinguish between those models, see the link for more details. – Stat Tistician May 1 '13 at 13:28
• Looks like the series has seasonals and trend. Integrate in the ADF-test a deterministic trend + seasonal dummies and run the test. Check also for autocorrelated residuals. – Pantera May 1 '13 at 23:07

Since you take the default value of k in adf.test, which in this case is 7, you're basically testing if the information set of the past 7 months helps explain $x_t - x_{t-1}$. Electricity usage has strong seasonality, as your plot shows, and is likely to be cyclical beyond a 7-month period. If you set k=12 and retest, the null of unit root cannot be rejected,

> adf.test(electricity, k=12)

Augmented Dickey-Fuller Test
data:  electricity
Dickey-Fuller = -1.9414, Lag order = 12, p-value = 0.602
alternative hypothesis: stationary


Assuming that "adf.test" really comes from the "tseries" package (directly or indirectly), the reason would be that it automatically includes a linear time trend. From the tseries doc (version 0.10-35): "The general regression equation which incorporates a constant and a linear trend is used [...]" So the test result indeed indicates trend stationarity (which despite the name is not stationary).

I also agree with Pantera that the seasonal effects could distort the result. The series could in reality be a time trend + deterministic seasonals + stochastic unit root process, but the ADF test might mis-interpret the seasonal fluctuations as stochastic reversions to the deterministic trend, which would imply roots smaller than unity. (On the other hand, given that you have included enough lags, this should rather show up as (spurious) unit roots at seasonal frequencies, not the zero/long-run frequency that the ADF test looks at. In any case, given the seasonal pattern it's better to include the seasonals.)