Skip to course content
Free Python statistics course

Statistical Data Analytics with Python

Module 09 Activity

Scenario

Build and check a multi-predictor model, and be honest about what its coefficients mean.

What you build

A statsmodels multiple regression with diagnostics run and its interpretation qualified.

Steps

  1. Decide the predictors from subject knowledge and the plan, not from p-values.
  2. Set the reference level for every categorical with C(var, Treatment(reference=...)) and state it in the caption.
  3. Report unadjusted and adjusted estimates side by side, and treat a large shift as evidence that more confounding may remain.
  4. Add an interaction only if pre-specified, and report the group-specific slopes rather than the interaction coefficient.
  5. Inspect residuals against fitted values, compute Cook's distance from get_influence(), and check VIF where predictors are related.
  6. Compare models on adjusted R-squared or held-out performance, never on R-squared.

Evidence to hand in

Review checklist