Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

After fitting a regression in Python, five statsmodels methods can help you investigate what its results mean: summary(), conf_int(), get_robustcov_results(), get_influence(), and compare_lr_test(). They answer different questions about the model’s output, parameter uncertainty, inference, influential observations, and nested-model fit. Here, “why” means diagnostic and inferential clues—not proof of causation.

How to choose the right statsmodels function

Statsmodels’ basic workflow is to specify a model, fit it, and inspect the resulting fitted-results object. These methods extend that inspection, but they are not interchangeable: choose one based on the question you need to answer.

Method Question answered What it cannot establish by itself
summary() What does the fitted model report at a glance? That the model’s assumptions hold or that the specification is complete.
conf_int() How uncertain are the fitted parameter estimates? That the model is correctly specified or supports a causal interpretation.
get_robustcov_results() How does inference change under a different covariance estimate? That omitted variables, functional-form errors, or confounding have been fixed.
get_influence() Can particular observations materially affect the fit? That a flagged observation is an error or should automatically be removed.
compare_lr_test() Does a less-restricted nested model improve fit enough to reject the restricted one? That the improvement is practically important or causal.

1. Use summary() for the overview

For many fitted results objects, summary() gathers model information and statistical output into a report. The getting-started guide demonstrates printing it with print(res.summary()). Use the summary to orient yourself: review the estimates, reported uncertainty, fit information, and other details shown for that model. It is a starting point, not a complete diagnostic report.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The summary API documents an alpha argument for the confidence-interval significance level and a slim option that can reduce diagnostic information. Available details may depend on the results class and statsmodels version. The current getting-started guide corroborates the summary workflow; detailed parameter notes for this method are labeled statsmodels 0.14.6, while the stable documentation identifies version 0.15.0.

2. Use conf_int() to inspect parameter uncertainty

Call conf_int() on fitted results to obtain confidence intervals for the parameter estimates. Read each interval alongside its estimate: the interval describes uncertainty under the fitted model and its inferential assumptions, rather than offering a guarantee about the estimate in every possible model.

A narrow interval does not validate the model specification, rule out omitted-variable bias, or establish causation. Use it to understand precision conditional on the model you actually fitted.

3. Use get_robustcov_results() to examine covariance-sensitive inference

get_robustcov_results() creates a new results instance with a robust covariance estimate as its default. The choice of covariance type matters: select one that is intended to address a feature of your data or error structure, and report that choice when presenting estimates and inference.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Because this changes the estimated covariance—and therefore uncertainty measures such as standard errors—it can change inferential conclusions without changing the underlying fitted specification. Robust covariance does not repair omitted variables, an incorrect functional form, or confounding, and it does not make a causal interpretation valid.

4. Use get_influence() to investigate influential observations

For OLS results, get_influence() returns an OLSInfluence object with measures used to assess observation influence and outlier behavior. Statsmodels’ diagnostics example illustrates studentized residuals, leverage, and Cook’s-distance-based influence plots. Together, these can help you find cases worth examining; they do not identify errors automatically.

Review a flagged case in context, check whether its data are valid, and consider sensitivity analysis—such as comparing results with and without the observation when that comparison is substantively justified. Do not delete observations solely because a diagnostic measure flags them.

5. Use compare_lr_test() for an appropriate nested-model comparison

compare_lr_test() performs a likelihood-ratio test framed as whether a restricted model is correct relative to a less-restricted model. The comparison requires appropriately nested models: the restricted model must be a restriction of the less-restricted one. Report the test statistic, degrees of freedom, and p-value so readers can assess the comparison.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A test result addresses the specified fit comparison; it is not an effect-size estimate, a measure of practical importance, or evidence of causation on its own.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use diagnostics to investigate assumptions, not certify a model

Beyond these five results methods, statsmodels’ regression diagnostics example covers tests for residual normality (Omni and Jarque–Bera), autocorrelation (Durbin–Watson and Breusch–Godfrey), heteroskedasticity (Breusch–Pagan and Goldfeld–Quandt), and linearity (Harvey–Collier), as well as influence measures. Many tests return tuples without annotations; consult the relevant method documentation or docstrings to interpret the returned values.

The diagnostics notebook also demonstrates residual-versus-fitted, normal-quantile, scale-location, leverage, and VIF views. Patterns can suggest possible nonlinearity, nonnormal residuals, nonconstant variance, leverage, or influential observations. Treat a test or plot as evidence about a particular assumption and a reason to investigate further—not as a universal pass/fail verdict on model quality.

Which function should you run next?

  • Need a compact account of the fitted results? Start with summary().
  • Need to express uncertainty around individual parameter estimates? Inspect conf_int().
  • Concerned that the covariance estimate may not suit the data’s error structure? Choose an appropriate robust covariance type with get_robustcov_results().
  • Wondering whether certain cases drive the fit? Examine the measures from get_influence() and investigate flagged observations.
  • Comparing a restricted model with an appropriate less-restricted nested model? Use compare_lr_test() and report the test statistic, degrees of freedom, and p-value.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.