mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
622e5aab69
commit
d83c9b5246
2 changed files with 50 additions and 32 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue