Page **1** of **1**

### Granger Causality

Posted: **July 15th, 2013, 9:40 am**

by **akkakarania**

Hi Members,I have two simple QQ1. Stock A &B ( High frequency 1min tick) i do EG test and found them to be co-integrated.A = B + err1B= A + err2both the above equation produces different coefficients so i want to know which equation is significant so i run Granger causality test which will tell me which co-efficient a.k.a which equation to pick. Am i right with the approach?2. For Pairs trading strategy, there are many methods, modelling spread with Kalman filtering is popular, however i wanted experts opinion on its comparison to co-integrating relationship... should i just bet on cointegrating relationship(vidya murthy 2004 book) or should i model spread.RegardsAjay

### Granger Causality

Posted: **July 24th, 2013, 1:31 pm**

by **chocolatemoney**

The goal of a trading strategy is to make money.I am not sure if picking the relationship with is also supported by Granger causality would give you the "best" trading strategy.Literature is rich of ideas for metrics that can be used to evaluate the quality and tradeability of the cointegrating relationship, how "good" the residuals look like and measures of the attractiveness of the back-test results. In the end, a good trading strategy may not need cointegration at all: it's the $$ and the risk-reward all that matters.However, yes, the presence of cointegration implies Granger causality at least in one direction (A->B or B->A)On your second point, I think that there's some confusion there: cointegrating regressions can be reformulated as ECM and as state-space models (KF). In the end, if Y = beta*x + e, you can always throw the beta*x on the LHS and there you have the spread. Maybe you could better clarify on (2)

### Granger Causality

Posted: **July 24th, 2013, 1:55 pm**

by **akkakarania**

2. For Pairs trading strategy, there are many methods, modelling spread with Kalman filtering is popular, however i wanted experts opinion on its comparison to co-integrating relationship... should i just bet on cointegrating relationship(vidya murthy 2004 book) or should i model spread.[Ajay] 1. Time period 1 to 10 days ... we do EG test, collect the residual co-efficient (beta) and constant and also the RMSE of residual.2. Future time period 11 onward( say 25-jul-2013).. we use the calculated beta(fixed) and constant ( both calculated until 24th Jul2013) and see the behavior of this residual..Question here is.. 1. we model the past ( i.e) 10 days data using the Kalman filter/DESP method? is it.. if yes, then how we use this from 25thJul onwards.... do we do monte carlo or something on the adaptive beta .... i am getting abit lost here...2. secondly, how to calculate the speed of mean reversion of the residual... i can simply calculate the frequency by calculating the number of points it crossed zero and dividing it by total time period hwoever that will suffer sample bais.. so we need to do bootstrapping.. but i dont know how to do tht... we take the residual series.. and then liike monte carlo... do say 5000 simulations ([picking from the collected residual)) and then see how the zero crossing behaves..i saw papers suggesting OU model but i really dont understand why i need to use it..many thanks

### Granger Causality

Posted: **July 24th, 2013, 2:47 pm**

by **chocolatemoney**

Quote 2. Future time period 11 onward( say 25-jul-2013).. we use the calculated beta(fixed) and constant ( both calculated until 24th Jul2013) and see the behavior of this residual.. I am sorry, I am now even more confused on what you're trying to achieve.Anyhow, based on historical data, you'll have information on the behavior of the spread.You'll then receive fresh information, that will be added to the historical pile of data.As you receive fresh information, you'll have to decide if you want to open/close/stay hold, just it. There's no need of running monte carlo simulations.At the same time, as you receive fresh information, you'll refresh your estimates for the parameters (how, depends on your model) and continue monitoring metrics on the reliability of your trading algorithm and of the econometric relationships behind it.Quote secondly, how to calculate the speed of mean reversion of the residual $It still may be worth checking the number of zero crossing over the data points and the distribution of the time lag between zero crossings. It gives you an idea of your trading frequency in terms of order of magnitude (days, weeks, minutes, ..) provided your time series is long enough wrt your trading horizon and encompasses different market environments. There's not a clear definition for market environment but the idea is that your system should have delivered (or at least limited damages) in the midst of the Lehman crisis as in a day where markets are relatively calm.Btw, do not forget to model slippage (the fact that other traders might grab ticks faster than you) in your backtest. High frequency trading is a very competitive industry.[Edit] uhm, bootstrapping is very tricky. Are residuals iid?

### Granger Causality

Posted: **July 24th, 2013, 2:56 pm**

by **chocolatemoney**

Deleted

### Granger Causality

Posted: **July 24th, 2013, 3:09 pm**

by **akkakarania**

QuoteOriginally posted by: chocolatemoneyQuote 2. Future time period 11 onward( say 25-jul-2013).. we use the calculated beta(fixed) and constant ( both calculated until 24th Jul2013) and see the behavior of this residual.. I am sorry, I am now even more confused on what you're trying to achieve.Anyhow, based on historical data, you'll have information on the behavior of the spread.You'll then receive fresh information, that will be added to the historical pile of data.As you receive fresh information, you'll have to decide if you want to open/close/stay hold, just it. There's no need of running monte carlo simulations.At the same time, as you receive fresh information, you'll refresh your estimates for the parameters (how, depends on your model) and continue monitoring metrics on the reliability of your trading algorithm and of the econometric relationships behind it.[Ajay Kakarnia] Based on historical data, we get the residual, however as i understand, we need to forecast this residual to get the maximum bucks for the money... and to do that we need to model it.. something like Kalman filter.. where i am getting lost is.. how to use this adaptive beta.. i know that it changes the historical values of beta based on its own pth but how it helps me for the future residual forecast... so i thought do we need to do bootstrapping/montecarlo for forecasting.. n hence the q...Quote secondly, how to calculate the speed of mean reversion of the residual $It still may be worth checking the number of zero crossing over the data points and the distribution of the time lag between zero crossings. It gives you an idea of your trading frequency in terms of order of magnitude (days, weeks, minutes, ..) provided your time series is long enough wrt your trading horizon and encompasses different market environments. There's not a clear definition for market environment but the idea is that your system should have delivered (or at least limited damages) in the midst of the Lehman crisis as in a day where markets are relatively calm.[Ajay Kakarania] yeah, transaction cost n slippage is the killer and so i m forced to look for leverage of 1:3 atleast to make money.. ... Btw, do not forget to model slippage (the fact that other traders might grab ticks faster than you) in your backtest. High frequency trading is a very competitive industry.[Edit] uhm, bootstrapping is very tricky. Are residuals iid?[Ajay Kakarania] residual are not iid... wish they were... but i think we can approx them because they are nice mean-reverting...

### Granger Causality

Posted: **July 24th, 2013, 3:43 pm**

by **chocolatemoney**

Yes, sorry, it was not really a real question, but AFAIK, bootstrapping requires iid or at least independence.Not sure then how vidyamurthy does the trick then.Anyhow, the book is not clearly written. I also kinda remembering reading some inaccuracies..

### Granger Causality

Posted: **July 24th, 2013, 3:47 pm**

by **chocolatemoney**

Quote [Ajay Kakarnia] Based on historical data, we get the residual, however as i understand, we need to forecast this residual to get the maximum bucks for the money... and to do that we need to model it.. something like Kalman filter.. where i am getting lost is.. how to use this adaptive beta.. i know that it changes the historical values of beta based on its own pth but how it helps me for the future residual forecast... so i thought do we need to do bootstrapping/montecarlo for forecasting.. n hence the q... You do not need to REALLY forecast the residual. You know that the residuals mean reverts (to zero). You enter the trade when the spread is high/low (you set your own policy) and you sell when it narrows downs.

### Granger Causality

Posted: **July 24th, 2013, 3:48 pm**

by **tagoma**

QuoteStock A &B ( High frequency 1min tick) i do EG test and found them to be co-integrated.EG test is all about A causes B.cointegration is the story of a I(0) vector between two I(1) series (very loosely speaking), involving unit root tests of some kinds.How is EG test of help for cointegration purpose?Disclaimer: chocolatemoney's disclaimer applies.

### Granger Causality

Posted: **July 24th, 2013, 3:53 pm**

by **chocolatemoney**

On the KF side: the unknown variable is usually designed to be the weights of the trade lags. It is a way to adjust the weights (in the cointegrating regression they corresponded to the regression coeffs) filtering out some noise and reflecting fresh market data as it becomes available

### Granger Causality

Posted: **July 24th, 2013, 3:54 pm**

by **akkakarania**

but we know that Do n faff(2010) that the historic mean for the difference of prices between two stocks are not constant so if they trend then we need to model that.. dont we?

### Granger Causality

Posted: **July 24th, 2013, 3:55 pm**

by **chocolatemoney**

QuoteOriginally posted by: edouardQuoteStock A &B ( High frequency 1min tick) i do EG test and found them to be co-integrated.EG test is all about A causes B.cointegration is the story of a I(0) vector between two I(1) series (very loosely speaking), involving unit root tests of some kinds.How is EG test of help for cointegration purpose?Disclaimer: chocolatemoney's disclaimer applies.Good point. I read the sentence as: (I do EG test) & (i found them to be co-integrated) rather than (I do EG test) => (i found them to be co-integrated) [EDIT] I think the originator question was: given two cointegrating relationships (A on B and B on A) does Granger causality suggest me which one I should pick for my trading?My answer was: not necessary (see above)

### Granger Causality

Posted: **July 24th, 2013, 4:02 pm**

by **chocolatemoney**

QuoteOriginally posted by: akkakaraniabut we know that Do n faff(2010) that the historic mean for the difference of prices between two stocks are not constant so if they trend then we need to model that.. dont we?Well, you need to find a cointegrating vector. Then you'll have stationarity in your residuals, aka the spread you're looking at.

### Granger Causality

Posted: **July 25th, 2013, 10:09 am**

by **chocolatemoney**

### Granger Causality

Posted: **July 26th, 2013, 10:17 am**

by **akkakarania**

There is OU model to see the half time ( also the speed of mean reversion) and then there is VECM alpha to give the speed of mean reversion.. so there are two ways we get it... would you be able to shed some light on the difference between the two.. are they have different purposes or interpretation of mean reversion speed...Regards