Paul,<div><br></div><div>Thank you very much for sending this; I've seen the lightning talk slides, and spent some time playing with it.  I do have a couple observations.</div><div><br></div><div>First, often it seems like if I use the inverse of your code I get better results.  </div>
<div><br></div><div>i.e. I find that r$loadings[1,1] / r$loadings[2,1] is closer to what I get using other hedge ratio calculation methods.</div><div><br></div><div>I attached a hedge ratio calculating function called "btcdHedge" to use as a comparison.  I took the code for this function from </div>
<div><a href="http://quantivity.wordpress.com/2011/10/02/proxy-cross-hedging/">http://quantivity.wordpress.com/2011/10/02/proxy-cross-hedging/</a> </div><div><br></div><div>If I use btcdHedge to calculate the ratio between SPY and DIA since 2011-01-01, it tells me to sell 1.070554 DIA for each share of SPY that I am long.</div>
<div><br></div><div>That is very close to the 1.070894 I would get if I used  OLS with a zero intercept</div><div><br></div><div>If I use OLS with a floating intercept, I get 1.206745.</div><div><br></div><div><div>If I use your TLS code, I get 0.777546</div>
</div><div><br></div><div>So, your TLS code is the only one that gives a ratio of less than 1.</div><div><br></div><div>However, if I use the inverse of your code I get something close to OLS with floating intercept</div>
<div><div>r$loadings[1,1] / r$loadings[2,1]</div><div>[1] 1.286098</div></div><div><br></div><div><br></div><div>Second,</div><div>You say</div><div><div>
"Forcing a zero intercept requires an additional step: recentering the data around</div><div>their means prior to the PCA."</div></div><div><br></div><div>However, I get the same values regardless of whether I center around the means.</div>

<div><br></div><div>Thanks,<br>Garrett</div><div><br></div><div><div class="gmail_quote">On Tue, Nov 29, 2011 at 12:08 PM, Paul Teetor <span dir="ltr"><<a href="mailto:paulteetor@yahoo.com" target="_blank">paulteetor@yahoo.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
R-SIG-Finance community:<br>
<br>
I recently posted a short paper entitled Better Hedge Ratios for Spread<br>
Trading:<br>
<br>
    <a href="http://www.quanttrader.info/public/betterHedgeRatios.pdf" target="_blank">http://www.quanttrader.info/public/betterHedgeRatios.pdf</a><br>
<br>
The topic is pretty arcane but important to spread traders. A surprizing<br>
number of textbooks and practitioners simply use ordinary least squares<br>
(OLS) to calculate their hedge ratios, but OLS can give misleading results.<br>
The paper shows how to use total least squares (TLS) to obtain a better<br>
balanced spread. The needed R code is simple and included in the paper.<br>
<br>
The paper is based on a lightning talk I gave at the R/Finance Conference<br>
back in April.<br>
<br>
I welcome all comments. I can't guarantee I will quickly incorporate your<br>
feedback into the paper, unfortunately. Heck, it took me seven months just<br>
to get out this first version.<br>
<br>
Paul Teetor<br>
Elgin, IL   USA<br>
<a href="http://www.linkedin.com/in/paulteetor" target="_blank">http://www.linkedin.com/in/paulteetor</a><br>
<br>
"For quant traders, there are no bad days in the market. It's just more<br>
data."<br>
<br>
<br>
        [[alternative HTML version deleted]]<br>
<br>
_______________________________________________<br>
<a href="mailto:R-SIG-Finance@r-project.org" target="_blank">R-SIG-Finance@r-project.org</a> mailing list<br>
<a href="https://stat.ethz.ch/mailman/listinfo/r-sig-finance" target="_blank">https://stat.ethz.ch/mailman/listinfo/r-sig-finance</a><br>
-- Subscriber-posting only. If you want to post, subscribe first.<br>
-- Also note that this is not the r-help list where general R questions should go.<br>
</blockquote></div><br></div>