78 stand_dev_residuals_(0),
80 stand_error_slope_(0),
110 void computeRegression(
double confidence_interval_P,
111 std::vector<double>::const_iterator x_begin,
112 std::vector<double>::const_iterator x_end,
113 std::vector<double>::const_iterator y_begin,
114 bool compute_goodness =
true);
138 void computeRegressionWeighted(
double confidence_interval_P,
139 std::vector<double>::const_iterator x_begin,
140 std::vector<double>::const_iterator x_end,
141 std::vector<double>::const_iterator y_begin,
142 std::vector<double>::const_iterator w_begin,
143 bool compute_goodness =
true);
146 double getIntercept()
const;
148 double getSlope()
const;
150 double getXIntercept()
const;
152 double getLower()
const;
154 double getUpper()
const;
156 double getTValue()
const;
158 double getRSquared()
const;
160 double getStandDevRes()
const;
162 double getMeanRes()
const;
164 double getStandErrSlope()
const;
166 double getChiSquared()
const;
168 double getRSD()
const;
171 static inline double computePointY(
double x,
double slope,
double intercept)
173 return slope * x + intercept;
204 void computeGoodness_(
const std::vector<double>& X,
const std::vector<double>& Y,
double confidence_interval_P);
207 template <
typename Iterator>
211 template <
typename Iterator>
224 template <
typename Iterator>
227 double chi_squared = 0.0;
230 for (; xIter != x_end; ++xIter, ++yIter)
232 chi_squared += std::pow(*yIter -
computePointY(*xIter, slope, intercept), 2);
239 template <
typename Iterator>
242 double chi_squared = 0.0;
246 for (; xIter != x_end; ++xIter, ++yIter, ++wIter)
248 chi_squared += *wIter * std::pow(*yIter -
computePointY(*xIter, slope, intercept), 2);
LinearRegression()
Constructor.
Definition: LinearRegression.h:70
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
double rsd_
the relative standard deviation
Definition: LinearRegression.h:201
double upper_
The upper bound of the confidence interval.
Definition: LinearRegression.h:187
double chi_squared_
The value of the Chi Squared statistic.
Definition: LinearRegression.h:199
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:225
This class offers functions to perform least-squares fits to a straight line model, .
Definition: LinearRegression.h:65
static double computePointY(double x, double slope, double intercept)
given x compute y = slope * x + intercept
Definition: LinearRegression.h:171
double x_intercept_
The intercept of the fitted line with the x-axis.
Definition: LinearRegression.h:183
double t_star_
The value of the t-statistic.
Definition: LinearRegression.h:189
double stand_error_slope_
The standard error of the slope.
Definition: LinearRegression.h:197
double mean_residuals_
Mean of residuals.
Definition: LinearRegression.h:195
double slope_
The slope of the fitted line.
Definition: LinearRegression.h:181
double stand_dev_residuals_
The standard deviation of the residuals.
Definition: LinearRegression.h:193
double lower_
The lower bound of the confidence interval.
Definition: LinearRegression.h:185
double r_squared_
The squared correlation coefficient (Pearson)
Definition: LinearRegression.h:191
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:240
double intercept_
The intercept of the fitted line with the y-axis.
Definition: LinearRegression.h:179