Stats Regression ols - CyrilB1531/lodestar GitHub Wiki
Ordinary least squares — Lodestar.Stats.Regression
Two ways to fit a linear model by ordinary least squares. OrdinaryLeastSquares.Fit fits a linear
model and returns what a statsmodels summary table holds — the estimates, and how sure it is of
each of them. OrdinaryLeastSquares.Estimate fits the same
model and stops at the coefficients, their standard errors and the residual sum of squares, for a
caller fitting many.
Spans in, one summary out. A design is row-major, featureCount values per row, with no
constant column of your own: WithIntercept adds it. That is the shape
Lodestar.Metrics and
Lodestar.Preprocessing already use, so a matrix crosses between
them without being reshaped.
Why this exists
The estimate is the cheap half. Read through a MetadataLoadContext rather than through a README,
MathNet.Numerics 5.0.0 exports 5 333 members and every regression entry point among them
returns coefficients: MultipleRegression.QR, .Svd, .NormalEquations, .DirectMethod,
SimpleRegression.Fit, WeightedRegression.Weighted. GoodnessOfFit adds five whole-model
scalars. A coefficient covariance matrix does exist in that assembly —
Optimization.NonlinearMinimizationResult exports Covariance, Correlation and
StandardErrors — but it belongs to the non-linear minimisers and is unreachable from
LinearRegression. Past it there is no t statistic, no p-value, no interval on a coefficient, no
adjusted R-squared, no overall F and no VIF anywhere in the assembly.
Accord.Statistics 3.8.0 did have the whole table, and its repository is archived: last release
2017-10-19, last push 2020-11-18, LGPL-2.1. So the gap is not an unexplored one. It is a
maintained, permissively licensed, framework-free OLS table.
decisions/0003 has the
reading and what it decided.
Types
| Type | What it is |
|---|---|
OrdinaryLeastSquares |
Fits the model and builds the table. |
OlsSummary |
The fitted model, its errors, its p-values and its diagnostics. |
OlsEstimate |
The coefficients, their standard errors and t statistics, and the residual sum of squares. |
OlsOptions |
Whether to fit an intercept, and at what confidence. |
CovarianceType |
How the covariance of the estimates is estimated. |
See also
- Regression inference — reading the table.
- Weighted least squares — the same table, one weight per row.
- statsmodels → .NET — what is delegated and what is not.
- Python → C# equivalence.