I am calculating the correlation of two arrays.
x = {1,2,3};
y = {1,1,1};
The PearsonsCorrelation from apache commons math is returnin NaN for these arrays. i.e.
PearsonsCorrelation corr = new PearsonsCorrelation();
double result = corr.correlation(x, y); //result = NaN.
Why isn't the answer 0.0?
The Pearson correlation may be thought of as the ratio of covariance of these series to the product of their standard deviations. The problem stems from the fact that the second series has standard deviation of 0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With