47 template <
typename Real>
86 stand_dev_residuals_(0),
88 stand_error_slope_(0),
119 std::vector<double>::const_iterator x_begin,
120 std::vector<double>::const_iterator x_end,
121 std::vector<double>::const_iterator y_begin,
122 bool compute_goodness =
true);
147 std::vector<double>::const_iterator x_begin,
148 std::vector<double>::const_iterator x_end,
149 std::vector<double>::const_iterator y_begin,
150 std::vector<double>::const_iterator w_begin,
151 bool compute_goodness =
true);
179 static inline double computePointY(
double x,
double slope,
double intercept)
181 return slope * x + intercept;
213 void computeGoodness_(
const std::vector<Wm5::Vector2d>& points,
double confidence_interval_P);
216 template <
typename Iterator>
220 template <
typename Iterator>
233 template <
typename Iterator>
236 double chi_squared = 0.0;
239 for (; xIter != x_end; ++xIter, ++yIter)
241 chi_squared += std::pow(*yIter -
computePointY(*xIter, slope, intercept), 2);
248 template <
typename Iterator>
251 double chi_squared = 0.0;
255 for (; xIter != x_end; ++xIter, ++yIter, ++wIter)
257 chi_squared += *wIter * std::pow(*yIter -
computePointY(*xIter, slope, intercept), 2);
This class offers functions to perform least-squares fits to a straight line model,...
Definition: LinearRegression.h:74
void computeRegressionWeighted(double confidence_interval_P, std::vector< double >::const_iterator x_begin, std::vector< double >::const_iterator x_end, std::vector< double >::const_iterator y_begin, std::vector< double >::const_iterator w_begin, bool compute_goodness=true)
This function computes the best-fit linear regression coefficients of the model for the weighted da...
double r_squared_
The squared correlation coefficient (Pearson)
Definition: LinearRegression.h:199
double getRSquared() const
Non-mutable access to the squared Pearson coefficient.
void computeGoodness_(const std::vector< Wm5::Vector2d > &points, double confidence_interval_P)
Computes the goodness of the fitted regression line.
double getIntercept() const
Non-mutable access to the y-intercept of the straight line.
double x_intercept_
The intercept of the fitted line with the x-axis.
Definition: LinearRegression.h:191
double getUpper() const
Non-mutable access to the upper border of confidence interval.
LinearRegression()
Constructor.
Definition: LinearRegression.h:78
double lower_
The lower bound of the confidence interval.
Definition: LinearRegression.h:193
virtual ~LinearRegression()=default
Destructor.
void computeRegression(double confidence_interval_P, std::vector< double >::const_iterator x_begin, std::vector< double >::const_iterator x_end, std::vector< double >::const_iterator y_begin, bool compute_goodness=true)
This function computes the best-fit linear regression coefficients of the model for the dataset .
double getXIntercept() const
Non-mutable access to the x-intercept of the straight line.
static double computePointY(double x, double slope, double intercept)
given x compute y = slope * x + intercept
Definition: LinearRegression.h:179
double upper_
The upper bound of the confidence interval.
Definition: LinearRegression.h:195
LinearRegression & operator=(const LinearRegression &arg)
Not implemented.
double computeWeightedChiSquare(Iterator x_begin, Iterator x_end, Iterator y_begin, Iterator w_begin, double slope, double intercept)
Compute the chi squared of a weighted linear fit.
Definition: LinearRegression.h:249
double t_star_
The value of the t-statistic.
Definition: LinearRegression.h:197
double getRSD() const
Non-mutable access to relative standard deviation.
double computeChiSquare(Iterator x_begin, Iterator x_end, Iterator y_begin, double slope, double intercept)
Compute the chi squared of a linear fit.
Definition: LinearRegression.h:234
double getTValue() const
Non-mutable access to the value of the t-distribution.
double getStandErrSlope() const
Non-mutable access to the standard error of the slope.
double getSlope() const
Non-mutable access to the slope of the straight line.
double getChiSquared() const
Non-mutable access to the chi squared value.
double chi_squared_
The value of the Chi Squared statistic.
Definition: LinearRegression.h:207
double intercept_
The intercept of the fitted line with the y-axis.
Definition: LinearRegression.h:187
double slope_
The slope of the fitted line.
Definition: LinearRegression.h:189
double getLower() const
Non-mutable access to the lower border of confidence interval.
double mean_residuals_
Mean of residuals.
Definition: LinearRegression.h:203
double stand_dev_residuals_
The standard deviation of the residuals.
Definition: LinearRegression.h:201
LinearRegression(const LinearRegression &arg)
Not implemented.
double rsd_
the relative standard deviation
Definition: LinearRegression.h:209
double getMeanRes() const
Non-mutable access to the residual mean.
double stand_error_slope_
The standard error of the slope.
Definition: LinearRegression.h:205
double getStandDevRes() const
Non-mutable access to the standard deviation of the residuals.
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
Definition: LinearRegression.h:46
Vector2< double > Vector2d
Definition: LinearRegression.h:48
Definition: LinearRegression.h:48