From 0d2a5b096c226e4e64c8dcf23e932d35f63ebde6 Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Sat, 16 Nov 2013 15:51:37 +0100 Subject: [PATCH] GoodnessOfFit: docs, add R value --- src/Numerics/GoodnessOfFit.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Numerics/GoodnessOfFit.cs b/src/Numerics/GoodnessOfFit.cs index 1908d8ec..e675773a 100644 --- a/src/Numerics/GoodnessOfFit.cs +++ b/src/Numerics/GoodnessOfFit.cs @@ -34,15 +34,28 @@ namespace MathNet.Numerics public static class GoodnessOfFit { /// - /// Calculated the R-Squared value given modelled and observed values + /// Calculated the R-Squared value, also known as coefficient of determination, + /// given modelled and observed values /// /// The values expected from the modelled /// The actual data set values obtained - /// + /// Squared Person product-momentum correlation coefficient. public static double RSquared(IEnumerable modelledValues, IEnumerable observedValues) { var corr = Correlation.Pearson(modelledValues, observedValues); return corr * corr; } + + /// + /// Calculated the R value, also known as linear correlation coefficient, + /// given modelled and observed values + /// + /// The values expected from the modelled + /// The actual data set values obtained + /// Person product-momentum correlation coefficient. + public static double R(IEnumerable modelledValues, IEnumerable observedValues) + { + return Correlation.Pearson(modelledValues, observedValues); + } } }