From d83c9b524622286d4dcd35d1233dfc722511a5be Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Sun, 10 Jan 2021 00:12:41 +0100 Subject: Indicate goodness of fit of regression line The goodness of fit of a regression line is the percentage of the variance of the y values that is explained by the dependence on the x values. Set the alpha value of the regression line to this goodness of fit. Further, set the width of the regression line to a standard deviation of the values from the regression line valies. Signed-off-by: Robert C. Helling --- stats/statsview.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'stats/statsview.h') diff --git a/stats/statsview.h b/stats/statsview.h index fbf51d46e..198ded14f 100644 --- a/stats/statsview.h +++ b/stats/statsview.h @@ -9,6 +9,7 @@ #include #include #include +#include struct dive; struct StatsBinner; @@ -117,11 +118,12 @@ private: // A regression line struct RegressionLine { - std::unique_ptr item; + std::unique_ptr item; StatsAxis *xAxis, *yAxis; double a, b; // y = ax + b + double width; void updatePosition(); - RegressionLine(double a, double b, QPen pen, QGraphicsScene *scene, StatsAxis *xAxis, StatsAxis *yAxis); + RegressionLine(double a, double b, double width, QBrush brush, QGraphicsScene *scene, StatsAxis *xAxis, StatsAxis *yAxis); }; // A line marking median or mean in histograms @@ -134,7 +136,7 @@ private: HistogramMarker(double val, bool horizontal, QPen pen, QGraphicsScene *scene, StatsAxis *xAxis, StatsAxis *yAxis); }; - void addLinearRegression(double a, double b, double minX, double maxX, double minY, double maxY, StatsAxis *xAxis, StatsAxis *yAxis); + void addLinearRegression(double a, double b, double res2, double r2, double minX, double maxX, double minY, double maxY, StatsAxis *xAxis, StatsAxis *yAxis); void addHistogramMarker(double pos, const QPen &pen, bool isHorizontal, StatsAxis *xAxis, StatsAxis *yAxis); StatsState state; -- cgit v1.2.3-70-g09d2