Purpose
To check whether if two raw prices are cointegrated, whether the returns are also cointegrated.

> y <- security.db1[, "PFC"]
> x <- security.db1[, "RECLTD"]
> z <- cbind(y, x)
> z <- diff(log(z))
> z <- cbind(cumsum(z[, 1]), cumsum(z[, 2]))
> par(mfrow = c(1, 1))
> plot.ts(z[, 1], col = "blue", lwd = 2, ylim = c(-0.2, 0.5))
> par(new = T)
> plot.ts(z[, 2], col = "red", lwd = 2, , ylim = c(-0.2, 0.5))

RawVsReturns-001.jpg

Lets compare the residual from the returns scale and raw price scale

> par(mfrow = c(1, 2))
> plot.ts(resid(lm(z[, 1] ~ z[, 2] + 0)), col = "blue", lwd = 2,
+     main = "Returns Scale")
> plot.ts(resid(lm(y ~ x + 0)), col = "blue", lwd = 2, main = "Raw Price Scale")

RawVsReturns-002.jpg

Test using Phillip Ouliaris test

> z1 <- cbind(z[, 2], z[, 1])
> (po.test(z1))$p.value
[1] 0.01
> z2 <- cbind(x, y)
> (po.test(z2))$p.value
[1] 0.01

Thus a pair if it is cointegrated on the raw price series is also cointegrated at the returns scale.


What about the other way round ? If I know that a pair is not cointegrated , will the returns be cointegrated ?

Let me check ACC GRASIM

> y <- security.db1[, "ACC"]
> x <- security.db1[, "GRASIM"]
> z <- cbind(y, x)
> z <- diff(log(z))
> z <- cbind(cumsum(z[, 1]), cumsum(z[, 2]))
> par(mfrow = c(1, 1))
> plot.ts(z[, 1], col = "blue", lwd = 2, ylim = c(-0.2, 0.5))
> par(new = T)
> plot.ts(z[, 2], col = "red", lwd = 2, , ylim = c(-0.2, 0.5))

RawVsReturns-004.jpg

Lets compare the residual from the returns scale and raw price scale

> par(mfrow = c(1, 2))
> plot.ts(resid(lm(z[, 1] ~ z[, 2] + 0)), col = "blue", lwd = 2,
+     main = "Returns Scale")
> plot.ts(resid(lm(y ~ x + 0)), col = "blue", lwd = 2, main = "Raw Price Scale")

RawVsReturns-005.jpg

Testing the Non stationarity of both the series Let me do a Unit root test to the cumulative returns series

> y <- security.db1[, "ACC"]
> x <- security.db1[, "GRASIM"]
> z <- cbind(y, x)
> z <- diff(log(z))
> z <- cbind(cumsum(z[, 1]), cumsum(z[, 2]))
> fit <- lm(z[, 1] ~ z[, 2] + 0)
> error <- residuals(fit)
> unitrootTest(error, lags = 1, type = "ct")@test$p.value[1]
        t
0.3306459
> fit <- lm(y ~ x + 0)
> error <- residuals(fit)
> unitrootTest(error, lags = 1, type = "ct")@test$p.value[1]
        t
0.3875088

Test using Phillip Ouliaris test

> z1 <- z
> (po.test(z1))$p.value
[1] 0.15
> z2 <- cbind(y, x)
> (po.test(z2))$p.value
[1] 0.15

Clearly the Phillip Ouliaris test fails the cointegration in both the returns and raw price scale.