Engauge Digitizer  2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Friends | List of all members
FittingStatistics Class Reference

This class does the math to compute statistics for FittingWindow. More...

#include <FittingStatistics.h>

Collaboration diagram for FittingStatistics:
Collaboration graph

Public Member Functions

 FittingStatistics ()
 Single constructor. More...
 
virtual ~FittingStatistics ()
 
void calculateCurveFitAndStatistics (unsigned int order, const FittingPointsConvenient &pointsConvenient, FittingCurveCoefficients &coefficients, double &mse, double &rms, double &rSquared, int significantDigits)
 Compute the curve fit and the statistics for that curve fit. More...
 

Friends

class TestFitting
 

Detailed Description

This class does the math to compute statistics for FittingWindow.

Definition at line 19 of file FittingStatistics.h.

Constructor & Destructor Documentation

FittingStatistics::FittingStatistics ( )

Single constructor.

Definition at line 15 of file FittingStatistics.cpp.

16 {
17 }
FittingStatistics::~FittingStatistics ( )
virtual

Definition at line 19 of file FittingStatistics.cpp.

20 {
21 }

Member Function Documentation

void FittingStatistics::calculateCurveFitAndStatistics ( unsigned int  order,
const FittingPointsConvenient pointsConvenient,
FittingCurveCoefficients coefficients,
double &  mse,
double &  rms,
double &  rSquared,
int  significantDigits 
)

Compute the curve fit and the statistics for that curve fit.

Parameters
orderRequested order of the polynomial to be fitted. This will be reduced if there are not enough points just enough to prevent having an undetermined system (=more degrees of freedom than constraints) since otherwise there will be an infinite number of solutions
pointsConvenientInput data consisting of (x,y) points in graph coordinates
coefficientsOutput coefficients a0, a1, and so on in y = a0 + a1 * x + a2 * x^2 + ...
mseMean squared error between the original data and the fitted curve
rmsRoot mean square error between the original data and the fitted curve
rSquaredR-squared error between the original data and the fitted curve
significantDigitsNumber of significant digits to be used to determine when determinants are too small

Definition at line 111 of file FittingStatistics.cpp.

118 {
119  // Let user know something is happening if a high order was picked since that can take a long time
120  qApp->setOverrideCursor (Qt::WaitCursor);
121 
122  // To prevent having an underdetermined system with an infinite number of solutions (which will result
123  // in divide by zero when computing an inverse) we reduce the order here if necessary.
124  // In other words, we limit the order to -1 for no points, 0 for one point, 1 for two points, and so on
125  int orderReduced = qMin (qFloor (order),
126  pointsConvenient.size() - 1);
127 
128  calculateCurveFit (orderReduced,
129  pointsConvenient,
130  coefficients,
131  significantDigits);
132  calculateStatistics (pointsConvenient,
133  coefficients,
134  mse,
135  rms,
136  rSquared);
137 
138  qApp->restoreOverrideCursor();
139 }

Friends And Related Function Documentation

friend class TestFitting
friend

Definition at line 22 of file FittingStatistics.h.


The documentation for this class was generated from the following files: