I have some closing price data for two Australian banks which track each other very closely.
http://dl.dropbox.com/u/12337149/stat/CBA.csv
http://dl.dropbox.com/u/12337149/stat/WBC.csv
Code from this web page produces the following output
Assumed hedge ratio is 2.26
ADF p-value is 0.47
When I plot the prices, I obtain a chart that looks cointegrated
What I don't understand is why my p-value is so high. My slightly adapted R code is below.
library(zoo)
library(tseries)
gld <- read.csv("C:\\...\\CBA.csv", stringsAsFactors=F)
gdx <- read.csv("C:\\...\\WBC.csv", stringsAsFactors=F)
gld <- zoo(gld[,5], as.Date(gld[,1]))
gdx <- zoo(gdx[,5], as.Date(gdx[,1]))
t.zoo <- merge(gld, gdx, all=FALSE)
t <- as.data.frame(t.zoo)
cat("Date range is", format(start(t.zoo)), "to", format(end(t.zoo)), "\n")
m <- lm(gld ~ gdx + 0, data=t)
beta <- coef(m)[1]
cat("Assumed hedge ratio is", beta, "\n")
sprd <- t$gld - beta*t$gdx
ht <- adf.test(sprd, alternative="stationary", k=0)
cat("ADF p-value is", ht$p.value, "\n")
if (ht$p.value < 0.05) {
cat("The spread is likely mean-reverting\n")
} else {
cat("The spread is not mean-reverting.\n")
}