![]() |
OpenMS
|
Helper class for weighted linear regression. More...
Public Member Functions | |
| void | clear () |
| Reset accumulator for new regression. | |
| void | addPointW (double x, double y, double weight) |
| Add a weighted data point to the regression. | |
| void | calculate () |
| Compute least-squares line parameters. | |
| double | getOffset () |
| Get regression intercept (y-value at x=0). | |
| double | getSlope () |
| Get regression slope (dy/dx). | |
Public Attributes | |
| double | sum_weights = 0 |
| Sum of weights. | |
| double | sum_x = 0 |
| Sum of weighted x values. | |
| double | sum_y = 0 |
| Sum of weighted y values | |
| double | sum_xy = 0 |
| Sum of weighted x*y products. | |
| double | sum_x2 = 0 |
| Sum of weighted x² values. | |
| double | offset = NAN |
| Regression intercept (cached) | |
| double | slope = NAN |
| Regression slope (cached) | |
| bool | calculated = false |
| Whether regression has been computed. | |
Helper class for weighted linear regression.
Accumulates weighted (x,y) points and computes least-squares line fit on demand. Used for boundary extrapolation.
| void addPointW | ( | double | x, |
| double | y, | ||
| double | weight | ||
| ) |
Add a weighted data point to the regression.
| x | independent variable value |
| y | dependent variable value |
| weight | point weight (≥ 0) |
| void calculate | ( | ) |
Compute least-squares line parameters.
Solves normal equations for weighted linear regression. Sets calculated = true and caches offset/slope.
| void clear | ( | ) |
Reset accumulator for new regression.
| double getOffset | ( | ) |
Get regression intercept (y-value at x=0).
| double getSlope | ( | ) |
Get regression slope (dy/dx).
| bool calculated = false |
Whether regression has been computed.
| double offset = NAN |
Regression intercept (cached)
| double slope = NAN |
Regression slope (cached)
| double sum_weights = 0 |
Sum of weights.
| double sum_x = 0 |
Sum of weighted x values.
| double sum_x2 = 0 |
Sum of weighted x² values.
| double sum_xy = 0 |
Sum of weighted x*y products.
| double sum_y = 0 |
Sum of weighted y values