diff options
author | Robert C. Helling <helling@atdotde.de> | 2021-01-10 00:12:41 +0100 |
---|---|---|
committer | Robert C. Helling <helling@atdotde.de> | 2021-01-14 20:51:23 +0100 |
commit | d83c9b524622286d4dcd35d1233dfc722511a5be (patch) | |
tree | 6f332b5580caa8b9e510ba8f751db6e1ffecb604 /stats/statsview.h | |
parent | 622e5aab692082509fcba8fba53ea2b16342e0d4 (diff) | |
download | subsurface-d83c9b524622286d4dcd35d1233dfc722511a5be.tar.gz |
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 <helling@atdotde.de>
Diffstat (limited to 'stats/statsview.h')
-rw-r--r-- | stats/statsview.h | 8 |
1 files changed, 5 insertions, 3 deletions
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 <QImage> #include <QPainter> #include <QQuickItem> +#include <QGraphicsPolygonItem> struct dive; struct StatsBinner; @@ -117,11 +118,12 @@ private: // A regression line struct RegressionLine { - std::unique_ptr<QGraphicsLineItem> item; + std::unique_ptr<QGraphicsPolygonItem> 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; |