This class offers functions to perform least-squares fits to a straight line model,
.
More...
#include <OpenMS/MATH/STATISTICS/LinearRegression.h>
Public Member Functions | |
| LinearRegression () | |
| Constructor. More... | |
| virtual | ~LinearRegression () |
| Destructor. More... | |
| template<typename Iterator > | |
| void | computeRegression (double confidence_interval_P, Iterator x_begin, Iterator x_end, Iterator y_begin) |
This function computes the best-fit linear regression coefficients of the model for the dataset . More... | |
| template<typename Iterator > | |
| void | computeRegressionNoIntercept (double confidence_interval_P, Iterator x_begin, Iterator x_end, Iterator y_begin) |
This function computes the best-fit linear regression coefficient of the model for the dataset . More... | |
| template<typename Iterator > | |
| void | computeRegressionWeighted (double confidence_interval_P, Iterator x_begin, Iterator x_end, Iterator y_begin, Iterator w_begin) |
This function computes the best-fit linear regression coefficients of the model for the weighted dataset . More... | |
| DoubleReal | getIntercept () const |
| Non-mutable access to the y-intercept of the straight line. More... | |
| DoubleReal | getSlope () const |
| Non-mutable access to the slope of the straight line. More... | |
| DoubleReal | getXIntercept () const |
| Non-mutable access to the x-intercept of the straight line. More... | |
| DoubleReal | getLower () const |
| Non-mutable access to the lower border of confidence interval. More... | |
| DoubleReal | getUpper () const |
| Non-mutable access to the upper border of confidence interval. More... | |
| DoubleReal | getTValue () const |
| Non-mutable access to the value of the t-distribution. More... | |
| DoubleReal | getRSquared () const |
| Non-mutable access to the squared pearson coefficient. More... | |
| DoubleReal | getStandDevRes () const |
| Non-mutable access to the standard deviation of the residuals. More... | |
| DoubleReal | getMeanRes () const |
| Non-mutable access to the residual mean. More... | |
| DoubleReal | getStandErrSlope () const |
| Non-mutable access to the standard error of the slope. More... | |
| DoubleReal | getChiSquared () const |
| Non-mutable access to the chi squared value. More... | |
| DoubleReal | getRSD () const |
| Non-mutable access to relelative standard deviation. More... | |
Protected Member Functions | |
| void | computeGoodness_ (double *X, double *Y, int N, double confidence_interval_P) |
| Computes the goodness of the fitted regression line. More... | |
| template<typename Iterator > | |
| void | iteratorRange2Arrays_ (Iterator x_begin, Iterator x_end, Iterator y_begin, double *x_array, double *y_array) |
| Copies the distance(x_begin,x_end) elements starting at x_begin and y_begin into the arrays x_array and y_array. More... | |
| template<typename Iterator > | |
| void | iteratorRange3Arrays_ (Iterator x_begin, Iterator x_end, Iterator y_begin, Iterator w_begin, double *x_array, double *y_array, double *w_array) |
| Copy the distance(x_begin,x_end) elements starting at x_begin, y_begin and w_begin into the arrays x_array, y_array and w_array. More... | |
Protected Attributes | |
| double | intercept_ |
| The intercept of the fitted line with the y-axis. More... | |
| double | slope_ |
| The slope of the fitted line. More... | |
| double | x_intercept_ |
| The intercept of the fitted line with the x-axis. More... | |
| double | lower_ |
| The lower bound of the confidence intervall. More... | |
| double | upper_ |
| The upper bound of the confidence intervall. More... | |
| double | t_star_ |
| The value of the t-statistic. More... | |
| double | r_squared_ |
| The squared correlation coefficient (Pearson) More... | |
| double | stand_dev_residuals_ |
| The standard deviation of the residuals. More... | |
| double | mean_residuals_ |
| Mean of residuals. More... | |
| double | stand_error_slope_ |
| The standard error of the slope. More... | |
| double | chi_squared_ |
| The value of the Chi Squared statistic. More... | |
| double | rsd_ |
| the relative standard deviation More... | |
Private Member Functions | |
| LinearRegression (const LinearRegression &arg) | |
| Not implemented. More... | |
| LinearRegression & | operator= (const LinearRegression &arg) |
| Not implemented. More... | |
This class offers functions to perform least-squares fits to a straight line model,
.
It capsulates the GSL methods for a weighted and an unweighted linear regression.
Next to the intercept with the y-axis and the slope of the fitted line, this class computes the:
|
inline |
Constructor.
|
inlinevirtual |
Destructor.
|
private |
Not implemented.
Computes the goodness of the fitted regression line.
Referenced by LinearRegression::computeRegression(), LinearRegression::computeRegressionNoIntercept(), and LinearRegression::computeRegressionWeighted().
| void computeRegression | ( | double | confidence_interval_P, |
| Iterator | x_begin, | ||
| Iterator | x_end, | ||
| Iterator | y_begin | ||
| ) |
This function computes the best-fit linear regression coefficients
of the model
for the dataset
.
The values in x-dimension of the dataset
are given by the iterator range [x_begin,x_end) and the corresponding y-values start at position y_begin.
For a "x %" Confidence Interval use confidence_interval_P = x/100. For example the 95% Confidence Interval is supposed to be an interval that has a 95% chance of containing the true value of the parameter.
| Exception::UnableToFit | is thrown if fitting cannot be performed |
References LinearRegression::chi_squared_, LinearRegression::computeGoodness_(), LinearRegression::intercept_, LinearRegression::iteratorRange2Arrays_(), and LinearRegression::slope_.
| void computeRegressionNoIntercept | ( | double | confidence_interval_P, |
| Iterator | x_begin, | ||
| Iterator | x_end, | ||
| Iterator | y_begin | ||
| ) |
This function computes the best-fit linear regression coefficient
of the model
for the dataset
.
The values in x-dimension of the dataset
are given by the iterator range [x_begin,x_end) and the corresponding y-values start at position y_begin.
For a "x %" Confidence Interval use confidence_interval_P = x/100. For example the 95% Confidence Interval is supposed to be an interval that has a 95% chance of containing the true value of the parameter.
| Exception::UnableToFit | is thrown if fitting cannot be performed |
References LinearRegression::chi_squared_, LinearRegression::computeGoodness_(), LinearRegression::intercept_, LinearRegression::iteratorRange2Arrays_(), and LinearRegression::slope_.
| void computeRegressionWeighted | ( | double | confidence_interval_P, |
| Iterator | x_begin, | ||
| Iterator | x_end, | ||
| Iterator | y_begin, | ||
| Iterator | w_begin | ||
| ) |
This function computes the best-fit linear regression coefficients
of the model
for the weighted dataset
.
The values in x-dimension of the dataset
are given by the iterator range [x_begin,x_end) and the corresponding y-values start at position y_begin. They will be weighted by the values starting at w_begin.
For a "x %" Confidence Interval use confidence_interval_P = x/100. For example the 95% Confidence Interval is supposed to be an interval that has a 95% chance of containing the true value of the parameter.
| Exception::UnableToFit | is thrown if fitting cannot be performed |
References LinearRegression::chi_squared_, LinearRegression::computeGoodness_(), LinearRegression::intercept_, LinearRegression::iteratorRange3Arrays_(), and LinearRegression::slope_.
| DoubleReal getChiSquared | ( | ) | const |
Non-mutable access to the chi squared value.
| DoubleReal getIntercept | ( | ) | const |
Non-mutable access to the y-intercept of the straight line.
| DoubleReal getLower | ( | ) | const |
Non-mutable access to the lower border of confidence interval.
| DoubleReal getMeanRes | ( | ) | const |
Non-mutable access to the residual mean.
| DoubleReal getRSD | ( | ) | const |
Non-mutable access to relelative standard deviation.
| DoubleReal getRSquared | ( | ) | const |
Non-mutable access to the squared pearson coefficient.
| DoubleReal getSlope | ( | ) | const |
Non-mutable access to the slope of the straight line.
| DoubleReal getStandDevRes | ( | ) | const |
Non-mutable access to the standard deviation of the residuals.
| DoubleReal getStandErrSlope | ( | ) | const |
Non-mutable access to the standard error of the slope.
| DoubleReal getTValue | ( | ) | const |
Non-mutable access to the value of the t-distribution.
| DoubleReal getUpper | ( | ) | const |
Non-mutable access to the upper border of confidence interval.
| DoubleReal getXIntercept | ( | ) | const |
Non-mutable access to the x-intercept of the straight line.
|
protected |
Copies the distance(x_begin,x_end) elements starting at x_begin and y_begin into the arrays x_array and y_array.
Referenced by LinearRegression::computeRegression(), and LinearRegression::computeRegressionNoIntercept().
|
protected |
Copy the distance(x_begin,x_end) elements starting at x_begin, y_begin and w_begin into the arrays x_array, y_array and w_array.
Referenced by LinearRegression::computeRegressionWeighted().
|
private |
Not implemented.
|
protected |
The value of the Chi Squared statistic.
Referenced by LinearRegression::computeRegression(), LinearRegression::computeRegressionNoIntercept(), and LinearRegression::computeRegressionWeighted().
|
protected |
The intercept of the fitted line with the y-axis.
Referenced by LinearRegression::computeRegression(), LinearRegression::computeRegressionNoIntercept(), and LinearRegression::computeRegressionWeighted().
|
protected |
The lower bound of the confidence intervall.
|
protected |
Mean of residuals.
|
protected |
The squared correlation coefficient (Pearson)
|
protected |
the relative standard deviation
|
protected |
The slope of the fitted line.
Referenced by LinearRegression::computeRegression(), LinearRegression::computeRegressionNoIntercept(), and LinearRegression::computeRegressionWeighted().
|
protected |
The standard deviation of the residuals.
|
protected |
The standard error of the slope.
|
protected |
The value of the t-statistic.
|
protected |
The upper bound of the confidence intervall.
|
protected |
The intercept of the fitted line with the x-axis.
| OpenMS / TOPP release 1.11.1 | Documentation generated on Thu Nov 14 2013 11:19:38 using doxygen 1.8.5 |