Take the 2-minute tour ×
Quantitative Finance Stack Exchange is a question and answer site for finance professionals and academics. It's 100% free, no registration required.

I am using the famous conintegrated pairs tutorial to just different stocks for cointegration. The adf.test yeilds perfect cointegration, which I feel must be incorrect. Here is why:

When I run adf.test() on a cumsum of a random series, the plot looks like this:enter image description here

And it yields the following adf.test output:

Augmented Dickey-Fuller Test data: sp Dickey-Fuller = -2.8333, Lag order = 4, p-value = 0.2314 alternative hypothesis: stationary

Here is a spread I constructed, notice how it looks similar to the random walk: enter image description here

Which yields the following adf.test() output:

Augmented Dickey-Fuller Test data: sprd3 Dickey-Fuller = 3.719, Lag order = 7, p-value = 0.99 alternative hypothesis: stationary Warning message: In adf.test(sprd3) : p-value greater than printed p-value

Any ideas what could be going on here? Why is the p-value extremely different between the two cases? I have a hard time believing that the spread I constructed in the graph is has a p-value of .99...

Thanks.

UPDATE I have looked into this problem some more and have revealed a little more that may help us get to the bottom of the .99 p-value.

Here is another spread I created: enter image description here

The spread looks a little more stable than the previous one I posted. I ran the adf.test() on this spread two different ways. The first was adf.test(sprd1). This came up with a p-value of .99, similar to what I have been experiencing.

However, when I use as.numeric() on the spread, the result is quite different. Executing adf.test(as.numeric(sprd1)) gives me a p-value of .07

Interesting. A little more info, the sprd1 data is an xts object with minute-by-minute data and no missing values.

xts version: 0.8-8 zoo version: 1.7-9 R version: 2.14

Maybe older packages are causing the problem?

share|improve this question
    
Which cases did you use for the ADF-tests? Did you check several lag orders and check the residuals for serial correlation? –  user21240 Oct 19 '13 at 16:36
    
Sorry Do I understand correctly... you get a massive p-value for the test so you cannot reject $H_0$ which is non-stationarity... why do you think it is stationary ? –  statquant Oct 21 '13 at 12:45
    
@statquant Yes, you are correct. I meant to ask why is the p-value so different between the two. They are both non-stationary, but the p-value using the spread data is VERY high. I would expect the p-values to be somewhat similar between the two. –  Stu Oct 21 '13 at 19:05
    
Stu, Why are you running an adf on the cumsum of a random series as a comparison? Almost any cumulative sum will have a unit root. –  Michael WS Dec 5 '13 at 16:36
add comment

1 Answer 1

Your spread does not look similar to the random walk. Many of the observations are the same as the previous observation. This means most of the first differences are zero, which is why the test indicates your series has a unit-root. The current value is very good at explaining what the next value will be.

share|improve this answer
    
Joshua, thanks for the response. I am not sure if this is the answer I am looking for, and I am editing the question to reveal some more information and maybe you can take another stab at it. –  Stu Oct 21 '13 at 19:09
    
The answer to your question is still the same. Remove all the observations where the first difference is zero and the p-value will drop: adf.test(sprd3[diff(sprd3)!=0]). –  Joshua Ulrich Oct 21 '13 at 19:13
    
I updated my question. I also tried your fix of dropping zero diffs, and it still yields .99. Adding as.numeric to the spread results in much more reasonable p-values. I am wondering if there is a package version error here. Check out what I added to my original question. –  Stu Oct 21 '13 at 19:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.