1
$\begingroup$

I'm a CS student working on a financial computing project + have a question regarding cointegration testing using linear regression with the lm() function.

https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/lm

Data:

data I've seen many examples through different strategies/notes online and was wondering which is the correct one to use under certain scenarios ( +0, +1, or nothing)

eg:

  m <- lm(series[[9]] ~ series[[1]] + 0)
  beta <- m$coefficients[1]
  cat ("Assumed hedge ratio is ", beta, "\n")
  sprd <- series[[9]] - beta * series[[1]]
  adf.test(sprd, alternative = 'stationary', k=0)$p.value #0.6647128

  m <- lm(series[[9]] ~ series[[1]] + 1)
  beta <- m$coefficients[1]
  cat ("Assumed hedge ratio is ", beta, "\n")
  sprd <- series[[9]] - beta * series[[1]]
  adf.test(sprd, alternative = 'stationary', k=0)$p.value #0.5656023

  model <- lm(series[[9]] ~ series[[1]])
  b <- model$coefficients[2]
  spreadp1 <- series[[9]] - b*series[[1]]
  adf.test(spreadp1, k=0)$p.value # 0.4339312
$\endgroup$
1
$\begingroup$

Hi: There are a couple of different issues in what you're doing.

A) One key question is what does "series" contain ?

B) 1) and 3) are always going to differ and it's never clear which is correct ( it's one of the pitfalls of the EG test ) I would do it both ways and see if the adf test result is consistent. Don't worry about the lack of consistency in the least squares estimate of the two approaches. The two procedures will only result in the same coefficient if you use total least squares regression instead of OLS.

C) Whether you use 2) versus (1 or 3) depends on whether you think that there is an intercept in the underlying model.

In the context of testing for cointegration, I would be inclined to not include an intercept because it sort of "locks" one series into being a specific amount higher ( or lower ) than the other series. Also, you want your least square estimate to be relatively stable over time ( i.e: when you go out of sample, you hope that your least squares estimate doesn't change ). By including an intercept, you're allowing for more flexibility in the non-intercept coefficient which is probably going to make it less stable out of sample.

$\endgroup$
2
  • $\begingroup$ ty for your reply 'series' is the open daily prices for the series. It's an array of 10 stocks and I have a strategy based off using 1 and 9 + their cointegration. It did well first 6 years then underperformed the last 3 This is more a question for me writing my report and wanted a better understanding of linear regression. ' I would be inclined to not include an intercept' meaning formula 1)? Just recently looked at this post: stats.stackexchange.com/questions/7948/… where they discuss dropping the intercept $\endgroup$ – Tom Apr 16 '20 at 23:23
  • $\begingroup$ Hi: Looking at it again, I realize now that the last 2 examples both include the intercept so one wouldn't expect the same result from 1) and 3) anyway. ( as I said earlier ). So forget that I said that. There are so many things to play with when doing this sort of thing but I would lean towards using log prices rather than prices. Also, I'm not clear on why are you only looking at stock 1 and 9 ? You might be better dealing with johnasen test. It's more complicated but it handles cointegrating vectors of length greater than 2. $\endgroup$ – mark leeds Apr 17 '20 at 0:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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