liveBook · Manning

Regression table

As explained in Statistics Every Programmer Needs

A regression table is a structured summary of a fitted regression model's estimates, uncertainty measures, and related statistics.

A regression table is a structured model output that summarizes estimated coefficients, uncertainty, significance, fit, and related statistics. It supports numerical evaluation more effectively than a scatter plot, especially when a model has multiple predictors. section 4.2.3

In Python, statsmodels produces a regression table after a fitted model is printed. For ordinary least squares, the output includes coefficient estimates, standard errors, t statistics, p-values, R-squared, adjusted R-squared, the F-statistic, observation counts, and information criteria. section 4.2.2

Read the table by connecting each measure to a modeling decision:

  • Interpret coef values as the estimated intercept and predictor effects; together they define predictions such as stage2 = −3.0778 + 1.3083 × stage1. section 4.2.3
  • Use standard errors, t statistics, and p-values to evaluate uncertainty and statistical significance for individual coefficients. section 4.2.3
  • Use R-squared to quantify explained variance; the fitted example reports approximately 0.575, while SST, SSR, and SSE separate total, explained, and unexplained variation. section 4.2.3
  • Use the F-statistic and its p-value to assess whether a linear model explains a statistically significant amount of response variance. section 4.2.3
  • For logistic regression, inspect coefficient estimates, p-values, goodness-of-fit statistics, and the likelihood-ratio p-value before considering predictor removal or model reduction. section 5.2.2

Printing a fitted table

Fit an ordinary least-squares model with statsmodels, then print its summary: lm = sm.OLS(y, x).fit(); print(lm.summary()). The resulting table reports the model structure and statistics needed to evaluate the relationship between stage1 and stage2. section 4.2.2

>>> lm = sm.OLS(y, x).fit()
>>> print(lm.summary())
                            OLS Regression Results                            
===========================================================================
Dep. Variable:              stage2   R-squared:                       0.575
Model:                         OLS   Adj. R-squared:                  0.551
Method:              Least Squares   F-statistic:                     24.35
Date:             Mon, 11 Mar 2024   Prob (F-statistic):           0.000107
Time:                     14:06:15   Log-Likelihood:                -97.991
No. Observations:               20   AIC:                             200.0
Df Residuals:                   18   BIC:                             202.0
Df Model:                        1                                         
Covariance Type:         nonrobust                                         
===========================================================================
              coef    std err          t      P>|t|      [0.025      0.975]
---------------------------------------------------------------------------
const      -3.0778     52.150     -0.059      0.954    -112.640     106.485
stage1      1.3083      0.265      4.934      0.000       0.751       1.865
===========================================================================
Omnibus:                     2.616   Durbin-Watson:                   2.326
Prob(Omnibus):               0.270   Jarque-Bera (JB):                2.150
Skew:                        0.749   Prob(JB):                        0.341
Kurtosis:                    2.420   Cond. No.                     1.34e+03
===========================================================================
Notes:
[1] Standard Errors assume that the covariance matrix of the 
errors is correctly specified.
[2] The condition number is large, 1.34e+03. This might 
indicate that there are strong multicollinearity or other 
numerical problems.

Inspect a complete statsmodels OLS regression table, including coefficient and fit-statistic columns. section 4.2.2

How Statistics Every Programmer Needs covers it

How deep it goes
Explains major output measures and their interpretation, but stops short of a complete treatment of regression assumptions.
Examples
Uses marathon split times, fitted values, sums-of-squares calculations, and raisin-variety classification to demonstrate regression summaries.
What it assumes
Assumes basic Python and regression concepts while demonstrating model fitting, coefficient interpretation, and fit-statistic calculations.
What you can do after
Interpret regression output with statsmodels and use its statistics to evaluate coefficients, predictions, fit, and significance.
How it connects
Connects coefficients, predictions, statistical significance, R-squared, sums of squares, F-tests, logistic regression, and multicollinearity.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Every Programmer Needs. The section links point to the parts of the book it draws on.