Correlation Matrix script doesn't match Excel numbers
Author: lkirsch
Creation Date: 4/6/2011 11:42 AM
profile picture

lkirsch

#1
If you compare the result produced by the correlation matrix
code with that produced by excel for an identical data set
I get quite different results. For the 50 days up to and
including 3/25/11 the program gives a correlation of -0.76
between ARMH and MZZ. Other methods give -0.55
profile picture

Eugene

#2
Try using the CorrelationXL DataSeries to match the Excel numbers. The script's author uses Pearson correlation series i.e. Correlation.Series. CorrelationXL.Series is a drop-in replacement.

The source code for the correlation indicator/method is available for download from the Wiki.
profile picture

lkirsch

#3
As I debug the problem, it seems to be that the problem is not in the
correlation code per se, but the DataSeries LNRet. If i remove this, and replace
it with Math.Log(C1[bar]/C1[bar-1]) where C1 is the DataSeries of Close's, I
get the right answer

profile picture

Eugene

#4
The LNRet DataSeries was originally created by Dr.Koch and used by such bright minds as gbeltrame during the WL4 times. The WL5/6 translation to C# produces results identic with the original WL4 version (found here).
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).