Correlation Chart
 03-15-2008, 10:24 PM #1 Recycles dryer sheets   Join Date: Nov 2005 Posts: 152 Correlation Chart Not to bug you guys but I am curious if this chart looks alright and makes sense: Index Fund Correlation Here is part of the code used to generate the correlation data: PHP Code: ``` // Correlation Calculation      public function correlation(\$x, \$y) {          //Correlation = NSXY - (SX)(SY) / Sqrt([NSX2 - (SX)2][NSY2 - (SY)2])                    \$Ex;          \$Ey;          \$Exy;          \$Exx;          \$Eyy;          \$xy = array();          \$xx = array();          \$yy = array();          \$num = count(\$x);          for (\$i = 0; \$i < count(\$x); \$i++) {             array_push(\$xy, \$x[\$i]*\$y[\$i]);             array_push(\$xx, \$x[\$i]*\$x[\$i]);             array_push(\$yy, \$y[\$i]*\$y[\$i]);          }                    \$Ex = array_sum(\$x);          \$Ey = array_sum(\$y);          \$Exy = array_sum(\$xy);          \$Exx = array_sum(\$xx);          \$Eyy = array_sum(\$yy);          if (\$Ex != 0) {   // Make sure we are not dividing by 0             \$corr = ((\$num * \$Exy) - (\$Ex * \$Ey)) / sqrt( ((\$num * \$Exx) - pow(\$Ex,2)) * ((\$num * \$Eyy) - pow(\$Ey,2)) );          }          \$corr = round(\$corr, 4);          return \$corr;      }  ``` __________________ __________________
 Join the #1 Early Retirement and Financial Independence Forum Today - It's Totally Free! Are you planning to be financially independent as early as possible so you can live life on your own terms? Discuss successful investing strategies, asset allocation models, tax strategies and other related topics in our online forum community. Our members range from young folks just starting their journey to financial independence, military retirees and even multimillionaires. No matter where you fit in you'll find that Early-Retirement.org is a great community to join. Best of all it's totally FREE! You are currently viewing our boards as a guest so you have limited access to our community. Please take the time to register and you will gain a lot of great new features including; the ability to participate in discussions, network with our members, see fewer ads, upload photographs, create a retirement blog, send private messages and so much, much more! Join Early-Retirment.org For Free - Click Here
 03-15-2008, 11:35 PM #2 Recycles dryer sheets   Join Date: Mar 2005 Posts: 329 hi trixs Nice website. The correlation stuff makes sense - nothing that looks obviously wrong. I was playing with your backtester and I have a couple of suggestions. 1. would it be possible to add a box with the running total at the bottom of the backtester page ie as I enter % for each asset class the total increases and will give an error if it does not add up to 100% 2. Can you also add some notes for the Yaxis in the drawdown chart? Thanks -h __________________ __________________ Hope springs eternal in the human breast:Man never is, but always to be blest. The soul, uneasy and confined from home,Rests and expatiates in a life to come.
03-16-2008, 12:15 AM   #3
Recycles dryer sheets

Join Date: Nov 2005
Posts: 152
Quote:
 Originally Posted by lswswein hi trixs Nice website. The correlation stuff makes sense - nothing that looks obviously wrong. I was playing with your backtester and I have a couple of suggestions. 1. would it be possible to add a box with the running total at the bottom of the backtester page ie as I enter % for each asset class the total increases and will give an error if it does not add up to 100% 2. Can you also add some notes for the Yaxis in the drawdown chart? Thanks -h
Thanks for looking! Opinions from you guys are the best because you have an idea what is actually be displayed. I ask a friend and they have no idea what they are looking at.

1. Yes I intend add a total percentage box. However it requires Java and I have yet to learn Java .

2. Hmm - I overlooked that - Good idea!
__________________

 03-16-2008, 07:54 AM #4 Give me a museum and I'll fill it. (Picasso)Give me a forum ...   Join Date: Jan 2008 Location: Chicagoland Posts: 11,974 It's a great utility you're working on and something that's of interest to a lot of us, thanks. Edit (I didn't notice the matrix at first): Your correlation matrix looks right, but IMHO your backtest doesn't seem to be working properly. If that's not finished, no need to read further. I developed a spreadsheet for my own use to gauge correlation based on the methodology in (what I consider) a great article on IndexUniverse, The Benefits of Low Correlation by Craig Israelsen, you may have seen it. My calcs tie out exactly with theirs so I'm confident I understand the calcs, and I have modified my AA to take advantage of more low correlation assets. If you're interested: The Benefits of Low Correlation - They use the 37 year period from 1970-2006 (almost the same as yours). The AA of interest in the article is based on seven assets, but since your model only allows whole integers, I plugged in the five-asset* example from the article. Returns and SD are about the same as yours, but they show a correlation of .211 whereas your backtest shows 0.91? They show the benchmarks for their assets and your model seems to have equivalents which I used - even if they're not exactly the same, the discrepancy should not be so dramatic. I also plugged in a 50/50 LCB/Commodities, and got a much higher correlation than I believe to be correct (based on the same article). Edit: It should match your matrix and it does not. So I'm puzzled. But yours would be superior by virtue of available asset classes and weighting if you can get it all working. FWIW... *20% each of Large US Equity (S&P), Small US Equity (SCB), Non US Equity (EAFE), US Int Term Bonds (Tot Bond) & Cash (MM) __________________ No one agrees with other people's opinions; they merely agree with their own opinions -- expressed by somebody else. Sydney Tremayne Retired Jun 2011 at age 57 Target AA: 60% equity funds / 35% bond funds / 5% cash Target WR: Approx 2.5% Approx 20% SI (secure income, SS only)
 03-16-2008, 09:50 AM #5 Recycles dryer sheets   Join Date: Nov 2005 Posts: 152 Taking a look - Look's like I have some bug finding. Thank You EDIT: I went ahead and read that article and found where the discrepancy is coming into play. (btw, good article!) In the article they are using an aggregate correlation. First of all they start off with small cap blend and LCB. These two correlate together at about .75, which checks. Next they add other asset classes and get the aggregate correlation. The correlation model that I used on the site is checking the total portfolio correlation vs the US Market - In this case the S&P 500. I will change this to clearly state what data source. Also, 50/50 LCB/Commodities correlates with the US market( S&P 500) at .60 . When comparing the two distinct data sequences, LCB and Commodities, they correlate together at -0.17. My plan of action - Allow people to use decimal points! __________________
 03-16-2008, 09:57 AM #6 Give me a museum and I'll fill it. (Picasso)Give me a forum ...   Join Date: Jan 2008 Location: Chicagoland Posts: 11,974 Like these? Seriously, what you're doing is great and we look forward to seeing the finished product. __________________ __________________ No one agrees with other people's opinions; they merely agree with their own opinions -- expressed by somebody else. Sydney Tremayne Retired Jun 2011 at age 57 Target AA: 60% equity funds / 35% bond funds / 5% cash Target WR: Approx 2.5% Approx 20% SI (secure income, SS only)

 Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)