Linear regression calculator using least squares method.
Computes the best-fit line y = c + m*x that minimizes the sum of squared residuals. Uses GSL for numerical computation.
Computed Statistics
| Field | Description |
| c | Y-intercept |
| m | Slope |
| r2 | Coefficient of determination (0-1) |
| sumsq | Sum of squared residuals |
| sigma | Standard deviation of errors |
| mse | Mean squared error |
Definition at line 98 of file lfit.H.
Construct and compute linear regression.
Fits the model y = c + m*x to minimize sum of squared errors. Computes R², standard deviation, and MSE.
- Parameters
-
| x | Array of independent variable values |
| y | Array of dependent variable values |
- Exceptions
-
- Example
Simple dynamic array with automatic resizing and functional operations.
DynList< T > maps(const C &c, Op op)
Classic map operation.
Linear regression calculator using least squares method.
Definition at line 149 of file lfit.H.
References ALEPHTHROW, Aleph::Array< T >::base(), c, cov00, cov01, cov11, Aleph::diff(), Aleph::error(), Aleph::is_normal_number(), m, Aleph::maps(), mse, Aleph::pow2(), r2, sigma, Aleph::Array< T >::size(), sqrt(), sumsq, y, and Aleph::zip_it().
Predict y-value and error for given x.
Uses the fitted model to predict y at the given x value, along with an error estimate based on the covariance matrix.
- Parameters
-
| x | Independent variable value |
- Returns
- Pair (predicted_y, error_estimate)
- Example
-
Definition at line 202 of file lfit.H.
References c, cov00, cov01, cov11, m, Aleph::maps(), and y.