Browse Source

Statistics: Fixed incorrect formula in WeightedPearson that could cause the correlation to be greater than 1.

netstandard
Jon Smit 10 years ago
parent
commit
2c83a519b8
  1. 3
      src/Numerics/Statistics/Correlation.cs

3
src/Numerics/Statistics/Correlation.cs

@ -146,9 +146,8 @@ namespace MathNet.Numerics.Statistics
meanB += rY;
varB += sumWeight*deltaY*rY;
covariance += deltaX*deltaY*wi*(sumWeight/temp);
sumWeight = temp;
covariance += deltaX*deltaY*(n - 1)*wi/n;
}
if (ieB.MoveNext())
{

Loading…
Cancel
Save