From 2a6083071f3c3a3757b8136f702d944c58a8a67a Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Sat, 25 Aug 2018 07:47:23 +0100 Subject: [PATCH] LR Model Fit calculate R2 .. lots of folks understand what R2 means for a linear regression so calculate it alongside RMSE when we are performing a linear regression. --- src/Charts/CPPlot.cpp | 2 +- src/Metrics/PDModel.cpp | 23 +++++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/Charts/CPPlot.cpp b/src/Charts/CPPlot.cpp index 7a9ad7e69..43556b288 100644 --- a/src/Charts/CPPlot.cpp +++ b/src/Charts/CPPlot.cpp @@ -703,7 +703,7 @@ CPPlot::plotModel() // Pmax is often higher than the test values (they're for // 3-20 mins typically so well short of pmax). if (!showDelta && rideSeries == RideFile::watts && pdModel && pdModel->PMax() > ymax) { - if (pdModel->PMax() > ymax) setAxisScale(yLeft, 0, pdModel->PMax()); + if (pdModel->PMax() > ymax) setAxisScale(yLeft, 0, pdModel->PMax() * 1.1f); } } diff --git a/src/Metrics/PDModel.cpp b/src/Metrics/PDModel.cpp index a66ebf2f8..bac2dbe47 100644 --- a/src/Metrics/PDModel.cpp +++ b/src/Metrics/PDModel.cpp @@ -176,11 +176,26 @@ PDModel::deriveCPParameters(int model) // get vector of residuals QVector residuals(t.size()); double errtot=0; + double sse=0; + double meany=0; for(int i=0; inparms() > 0) { // only try lmfit if the model supports that