Engauge Digitizer  2
FittingStatistics.h
1 /******************************************************************************************************
2  * (C) 2016 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3  * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4  * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5  ******************************************************************************************************/
6 
7 #ifndef FITTING_STATISTICS_H
8 #define FITTING_STATISTICS_H
9 
10 #include "FittingCurveCoefficients.h"
11 #include "FittingPointsConvenient.h"
12 #include <QVector>
13 
14 const int MAX_POLYNOMIAL_ORDER = 9; // Check execution time if this is increased from, say, 6 or 7
15 
16 class Matrix;
17 
20 {
21 public:
24  virtual ~FittingStatistics ();
25 
35  void calculateCurveFitAndStatistics (unsigned int order,
36  const FittingPointsConvenient &pointsConvenient,
37  FittingCurveCoefficients &coefficients,
38  double &mse,
39  double &rms,
40  double &rSquared);
41 
42 private:
43 
44  void calculateCurveFit (int orderReduced,
45  const FittingPointsConvenient &pointsConvenient,
46  FittingCurveCoefficients &coefficients);
47  void calculateStatistics (const FittingPointsConvenient &pointsConvenient,
48  const FittingCurveCoefficients &coefficients,
49  double &mse,
50  double &rms,
51  double &rSquared);
52  void loadXAndYArrays (int orderReduced,
53  const FittingPointsConvenient &pointsConvenient,
54  Matrix &X,
55  QVector<double> &Y) const;
56  double yFromXAndCoefficients (const FittingCurveCoefficients &coefficients,
57  double x) const;
58 };
59 
60 #endif // FITTING_STATISTICS_H
FittingStatistics()
Single constructor.
Matrix class that supports arbitrary NxN size.
Definition: Matrix.h:14
This class does the math to compute statistics for FittingWindow.
void calculateCurveFitAndStatistics(unsigned int order, const FittingPointsConvenient &pointsConvenient, FittingCurveCoefficients &coefficients, double &mse, double &rms, double &rSquared)
Compute the curve fit and the statistics for that curve fit.