# Counterintuitive Augmented Dickey Fuller test results

I am trying to determine wether the time series data I have is (covariance) stationary or not. This is the hourly data:

I proceeded to look at the acf as well as pacf plots in order to determine what kind of stochastic process might underlie the data.

Looking at the plots I would strongly assume that the data follows an AR(1) process, which to my understanding implies that the expected mean of the data $E(y_t)$ has to be 0 in order for the data to be covariance stationary (Wooldridge "Introductory Econometrics" pp.371). This is obviously not the case. So simply based on that, I would assume that the data is not covariance stationary.

Yet, computing the Augmented Dickey Fuller Test in R results in the following

> adf.test(Data_H_XTS$Data) Augmented Dickey-Fuller Test data: Data_H_XTS$Data
Dickey-Fuller = -4.6938, Lag order = 20, p-value = 0.01
alternative hypothesis: stationary

Warning message:
In adf.test(Data_H_XTS$Data) : p-value smaller than printed p-value  Is my above mentioned conclusion wrong? Or is the Augmented Dickey Fuller Test wrongly specified (i.e. the k-parameter, which is$P_{max}=[12(\frac{T}{100})^{1/4}]$where T is the number of observations)? My goal is to use this data in some kind of model so this diagnosis is basically the first step and right now, I am unsure what to do. Edit: I think I might have mixed something up. In an AR(1) process$E(y_t)$does not have to be 0, but rather constant, correct me if I am wrong. • Looking at your ACF I recommend you to take the first difference of the data. – Ferdi Nov 22 '17 at 11:33 • Thank you for your comment, that would have been my approach too. Yet, the result of the ADF test strikes me as rather surprising. It has to be biased in some way (assuming my assumption is right). – shenflow Nov 22 '17 at 11:43 • How did you specify deterministic terms in the test? – Christoph Hanck Nov 22 '17 at 12:09 • By default, the regression equation used in the test incorporates a constant and a linear trend. – shenflow Nov 22 '17 at 12:38 • I added a note at the end of the question. I would be grateful if you could also comment on that. – shenflow Nov 22 '17 at 14:48 ## 1 Answer The Dickey-Fuller test checks the null hypothesis unit root (simply put, that your process looks like a random walk$y_{t+1}=1y_{t}+\varepsilon_t$verisus the alternative that your process is a stationary AR(1) and looks like$y_{t+1}=\beta y_{t}+\varepsilon_t$with$\beta < 1$. The augmented version of it uses higher-order AR processes, but the principle is the same. The ADF test "thinks" that your series looks more like a stationary AR than like a random walk. And here I agree with it: the series does not look like a random walk. Random walk looks like this - after "shocks" (spikes) it usually does not return to the previous trend, but your series does. However, covariance-stationarity indeed assumes that$\mathbb{E}(x_t)$is constant, but in your case it is not - it has a kind of quadratic trend. ADF can do trend removal, but only if this trend is linear. So you have to remove your trend (which is possibly quadratic) and test your series again. Update. In the comment, you say that this "trend" is a result of yearly seasonality. If it is the case, you could fit a trigonometric function to your data, like this:$y(t)=\sum_{k=0}^K \cos(\frac{2\pi t k}{T})$, with not so large$K\$. After that, you can subtract the fitted values from the series, and consider this residual as de-trended data.

Update There might be other cycles. But seasonalies within the day can be removed by Dickey-Fuller if the AR order is at least 24, and seasonalities within the week - if its order is at least 24*7. With a year of hourly data you can probably afford it. So if your AR has a memory long enough, you may not worry about short cycles.

• Thank you for your answer! Okay, that leaves me with figuring out how to remove the quadratic trend. I´ll work on that then. Also, the data displays the period of 1 year. So as a matter of fact I know that the kind of quadratic trend is a kind of seasonality that occurs every year (spring/summer/autumn/winter). Yet, if my perspective is only one year, is this interpretetated as a trend and not a seasonality? – shenflow Nov 22 '17 at 18:44
• In the context of ADF test, no seasonality is assumed (or seasonality with lag less than K, where K is order of AR). So you have to interpret it as trend. – David Dale Nov 22 '17 at 19:15
• I have edited the answer to show one way to estimate the trend in your data, keeping in mind that it is in fact seasonality. – David Dale Nov 22 '17 at 19:24
• Very helpful comments, thank you. Alright, I will try out that approach. To my knowledge this method only pertains the overall "trend" over the course of the months. Since it is hourly data, there is also seasonality within the weeks and within the respective days (I dont actually think that there is seasonality in regards to the day of a month). I guess, those are things that I would have to remove as well, in order to make it stationary right? The multiple seasonalities kind of make this complicated (at least for me as an undergrad student). – shenflow Nov 22 '17 at 21:36
• Seasonalies within the day can be removed by Dickey-Fuller if the AR order is at least 24, and seasonalities within the week - if its order is at least 24*7. With a year of hourly data you can probably afford it. So if your AR has memory long enough, you may not worry about short cycles. – David Dale Nov 22 '17 at 21:44