Reply
 
Thread Tools Search this Thread Display Modes
Correlation Chart
Old 03-15-2008, 10:24 PM   #1
Recycles dryer sheets
 
Join Date: Nov 2005
Posts: 108
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($corr4);
          return 
$corr;
      } 
__________________
How to Invest
trixs is offline   Reply With Quote
Old 03-15-2008, 11:35 PM   #2
Recycles dryer sheets
 
Join Date: Mar 2005
Posts: 328
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.
lswswein is offline   Reply With Quote
Old 03-16-2008, 12:15 AM   #3
Recycles dryer sheets
 
Join Date: Nov 2005
Posts: 108
Quote:
Originally Posted by lswswein View Post
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!
__________________
How to Invest
trixs is offline   Reply With Quote
Old 03-16-2008, 07:54 AM   #4
Thinks s/he gets paid by the post
Midpack's Avatar
 
Join Date: Jan 2008
Location: Chicagoland
Posts: 1,518
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)
__________________
Retiring May 2010 --- maybe.

You only live once...
If a nation expects to be ignorant and free, in a state of civilization, it expects what never was and and never will be. Thomas Jefferson

Last edited by Midpack; 03-16-2008 at 09:24 AM.
Midpack is offline   Reply With Quote
Old 03-16-2008, 09:50 AM   #5
Recycles dryer sheets
 
Join Date: Nov 2005
Posts: 108
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!
__________________
How to Invest

Last edited by trixs; 03-16-2008 at 10:29 AM.
trixs is offline   Reply With Quote
Old 03-16-2008, 09:57 AM   #6
Thinks s/he gets paid by the post
Midpack's Avatar
 
Join Date: Jan 2008
Location: Chicagoland
Posts: 1,518


Like these?

Seriously, what you're doing is great and we look forward to seeing the finished product.
__________________
Retiring May 2010 --- maybe.

You only live once...
If a nation expects to be ignorant and free, in a state of civilization, it expects what never was and and never will be. Thomas Jefferson
Midpack is offline   Reply With Quote
Reply


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

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Yahoo fund chart built-in distortion joesxm FIRE and Money 11 12-19-2007 01:18 PM
Mutual Fund Chart with Dividend reinvested. Link? Sam Other topics 8 03-09-2007 11:13 PM
New Month- -Same Old Chart JPatrick FIRE and Money 10 02-28-2006 07:36 AM
Chart of S&P 500 v. P/E (both ttm and ftm) Arin38 FIRE and Money 12 07-03-2005 11:07 PM


Other Social Knowledge forum communities:
Cooking Forum - Sailing Forum - Early Retirement - Airstream Trailer - Aquarium Forum - Royal Forum - Book Forum - Volkswagen Touareg Forum - Jeep Wrangler Forum - Whitewater Kayaking & Rafting Forum - Fiberglass RV Forum - RV Forum - Truck Conversion - U2 Music Forum
Investing Channel
All times are GMT -6. The time now is 01:15 AM.
Powered by vBadvanced CMPS v3.0.1
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0