Skip to content
Tutorials Center
My learning

Topics

Lesson 3 of 28 ยท First Steps

Reading the Summary Table

Learn to read every part of the Statsmodels OLS summary: R-squared, F-statistic, AIC, coefficients, p-values, Omnibus, Durbin-Watson and Condition Number.

res.summary() prints the report that made Statsmodels famous. At first it looks like a wall of numbers. It is really three tables with a clear job each: how good is the model overall, what are the coefficients, and do the residuals behave. This lesson walks through all three.

Python Print the full summary

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Table 1: the model at a glance

The top block describes the model as a whole.

  • Dep. Variable / Model / Method: what you predicted and how.
  • No. Observations, Df Residuals, Df Model: sample size, observations minus parameters, and number of predictors.
  • R-squared: the share of variance in y the model explains, from 0 to 1.
  • Adj. R-squared: R-squared with a penalty per predictor. Use it to compare models of different sizes, because plain R-squared never falls when you add variables.
  • F-statistic and Prob (F-statistic): tests the claim that all slopes are zero. A tiny probability means at least one predictor matters.
  • Log-Likelihood, AIC, BIC: fit measures for comparing models on the same data. Lower AIC or BIC is better.
  • Covariance Type: nonrobust means classic standard errors. See Weighted and Robust Regression for the alternatives.

Table 2: the coefficients

Each row is one parameter.

Column Meaning
coef Estimated effect
std err Uncertainty of the estimate
t coef / std err
P>t p-value of the test that the true coefficient is 0
[0.025 0.975] 95% confidence interval

A p-value below 0.05 means the data are hard to explain if the true coefficient were zero. It does not mean the effect is large or important: always look at the coefficient and its interval in real units.

Table 3: the residual checks

The bottom block tests assumptions about the residuals.

  • Omnibus / Prob(Omnibus), Jarque-Bera (JB) / Prob(JB), Skew, Kurtosis: do the residuals look normal? A small probability suggests they do not.
  • Durbin-Watson: tests for correlation between neighboring residuals. Values near 2 are fine; near 0 or 4 signals trouble, usual for time-ordered data.
  • Cond. No.: condition number. Huge values (say above 1000 with unscaled data) hint at multicollinearity or just different scales.

The footnotes under the tables repeat the main warnings, such as "Standard Errors assume that the covariance matrix of the errors is correctly specified".

Pulling numbers out of the summary

The summary is text for people. For code, use attributes.

Python Use the key statistics in code

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Rather than parse the summary, read res.params, res.bse and friends directly, as in Your First OLS Model. res.summary().as_latex() and .as_csv() also export the tables.

Comparing two models

AIC and BIC make model comparison objective. A model with an extra predictor must earn its place by lowering the criteria.

Python Compare models with AIC, BIC and an F-test

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

noise is pure randomness, so the F-test should find no improvement, and BIC, which punishes extra parameters harder, should prefer the small model.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Why prefer Adj. R-squared over R-squared when comparing models of different sizes?

    Adding any variable cannot lower R-squared, so it rewards complexity. The adjusted version applies a penalty.
  2. 2. A Durbin-Watson value near 0 suggests what?

    Values near 2 mean no autocorrelation; near 0 means positive, near 4 negative autocorrelation.
  3. 3. What does Prob (F-statistic) test?

    The overall F-test compares the model with an intercept-only model.
  4. 4. Lower AIC means what, for two models fit on the same data?

    AIC rewards likelihood and penalizes parameters; lower is preferred.

Summary

  • The summary has three blocks: overall fit, coefficients, residual diagnostics.
  • A small p-value shows evidence against zero effect, not importance.
  • Use Adj. R-squared, AIC and BIC to compare models.
  • Read numbers from attributes (rsquared, aic, pvalues) in code.
  • Durbin-Watson, Omnibus and the condition number warn about assumption trouble.

Next: Formulas and Patsy