# Setting up a Dickey Fuller Test

I am in the process of brushing up on my skills about time series data. So I first started with doing a Dickey Fuller test in excel to test for stationary of some data series. I was using the example found on this page .

My hypothesis tests are as follows:

$H_o: B=0$ Is there a unit root?

$H_a: B<0$ The data is stationary and no unit root exists.

I want to reject the null and essentially accept the alternative.

So ran it and low and behold our answers differ in sign, theirs are positive and mine are negative. Here are some photos of what I entered into excel.  So now, let's assume I am right with what I did because I can't figure out how I could be wrong for now, hence the question. In testing the t-stat -1.812 is greater than -2.63 at the 10% level(using 10% based on their example).

Can I also get some help on testing t-values.

Data (use text to columns and then a space as the separator)

6109.58

6157.84 48.26

5850.22 -307.62

5976.63 126.41

6382.12 405.49

6437.74 55.62

6877.68 439.94

6611.79 -265.89

7040.23 428.44

6842.36 -197.87

6512.78 -329.58

6699.44 186.66

6700.2 0.76

7092.49 392.29

7558.5 466.01

7664.99 106.49

7589.78 -75.21

7366.89 -222.89

6931.43 -435.46

5530.71 -1400.72

5611.9 81.19

6208.28 596.38

6343.87 135.59

6485.94 142.07

• I don't follow your situation. Your column B data aren't a lag of your column A data, eg. You say that the results differed, but I see only 1 result. Etc. Sep 29, 2016 at 14:28
• Column B is the difference column. So B2=A2-A1. By results I mean the difference in sign on the coefficient and t-stat values. Sep 29, 2016 at 14:47
• did that answer your question @gung ? Sep 29, 2016 at 17:30
• Yes, I suppose so, thanks. I don't know time-series well, so I'll have to let others answer. Sep 29, 2016 at 17:34
• Can you post the data in a format so that we can reproduce the results with proper statistical software? Sep 29, 2016 at 18:01

When we follow the convention that the observation at the bottom is the most recent one (as the dates in your reference also suggest), you are right.

y <- c(6109.58,
6157.84,
5850.22,
5976.63,
6382.12,
6437.74,
6877.68,
6611.79,
7040.23,
6842.36,
6512.78,
6699.44,
6700.2,
7092.49,
7558.5,
7664.99,
7589.78,
7366.89,
6931.43,
5530.71,
5611.9,
6208.28,
6343.87,
6485.94)

summary(lm(diff(y)~y[1:(length(y)-1)]))

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept)          1700.2596   932.7901   1.823   0.0826 .
y[1:(length(y) - 1)]   -0.2546     0.1405  -1.813   0.0842 .
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


reproduces your result (do not look at the last column, under a unit root the p-values must come from other distributions).

I could reproduce the results from the reference via

r.y <- rev(y)
summary(lm(diff(r.y)~r.y[2:length(r.y)]))


but I would not know why that regression would be helpful. Maybe the order in which you mark the cells in Excel matters for the order of the data in the regression? If so, it would a powerful illustration of why Excel should not be your tool of choice for statistical analysis.