logo

Dickey-Fuller Test 📂Statistical Test

Dickey-Fuller Test

Hypothesis Testing

Given that we have time series data eq1.

  • eq2: The data eq1 does not have stationarity.
  • eq4: The data eq1 has stationarity.

Explanation

The Dickey-Fuller test is a hypothesis test used to determine whether time series data has stationarity or not. If it does not have stationarity, differencing must be used to make the mean constant. It is important to note that this diagnosis only occurs for the mean. Since it does not concern variance, a separate test is required for that.

Code

Practice

In R, the adf.test() function allows us to easily conduct the Dickey-Fuller test.

Let’s load the built-in data oil.price.

994F13335C734C0C26.png 20190227\_134432.png

Looking at the data, we can see a clear increasing trend as we move forward. In fact, conducting the Dickey-Fuller test shows that the p-value is very high at eq6. Since we cannot reject the null hypothesis, we cannot say that the data has stationarity.

991C8D335C734C0D20.png 20190227\_134448.png

On the other hand, after differencing, the data moves around eq7. Actually, when conducting the Dickey-Fuller test, the null hypothesis is rejected, indicating stationarity. However, as you can see, the variance increases over time. The Dickey-Fuller test indicating that the data has stationarity means that the mean is constant, not that it guarantees complete stationarity.

Full Code

library(tseries)
 
data("oil.price")
adf.test(oil.price)
adf.test(diff(oil.price))