LinearRegressionResult
LinearRegressionResult(**fields)Fitted ordinary least squares model, mirroring the C# LinearRegression class.
Carries no C++ state: predict reruns the fit against the shared toolbox runner each call, so an instance serializes with :mod:pickle.
covariance is the coefficient covariance matrix, i.e. numpy.sqrt(numpy.diag( result.covariance)) equals result.standard_errors. The underlying C# LinearRegression.Covariance is the unscaled cross-product term ((X'X)^-1), scaled here by sigma**2 to match standard_errors.
Methods
| Name | Description |
|---|---|
| predict | Predict from the fitted model. |
predict
LinearRegressionResult.predict(newdata, interval=False, level=0.9)Predict from the fitted model.
Mirrors the C# LinearRegression.Predict/PredictionIntervals methods.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| newdata | array_like | A 2D array of predictors with the same number of columns the model was fitted with (an intercept column, if any, is added internally), or – for a single-predictor model only – a 1D array of observations (matching R’s predict.corehydro_lm(), where a bare vector is unambiguous when there is one predictor). For more than one predictor a 1D array is rejected rather than guessed at, since it is ambiguous whether it means one row or one column. |
required |
| interval | bool | If True, also return the level prediction interval (a Student-t interval around the mean response, mirroring PredictionIntervals). Default False. |
False |
| level | float | Prediction interval level, between 0 and 1. Default 0.90, matching PredictionIntervals’s own alpha=0.1 default. |
0.9 |
Returns
| Name | Type | Description |
|---|---|---|
| numpy.ndarray | With interval=False, one predicted value per row of newdata. With interval=True, an (n, 3) array with columns lower, upper, mean. |