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
- Decide the predictors from subject knowledge and the plan, not from p-values.
- Set the reference level for every categorical with
C(var, Treatment(reference=...))and state it in the caption. - Report unadjusted and adjusted estimates side by side, and treat a large shift as evidence that more confounding may remain.
- Add an interaction only if pre-specified, and report the group-specific slopes rather than the interaction coefficient.
- Inspect residuals against fitted values, compute Cook's distance from
get_influence(), and check VIF where predictors are related. - Compare models on adjusted R-squared or held-out performance, never on R-squared.
Evidence to hand in
- The predictor list with its justification.
- The coefficient table with its reference level in the caption.
- The unadjusted and adjusted estimates.
- The interaction, if any, as group-specific slopes.
- The residual inspection, the Cook's distances and the VIFs.
- The model comparison.
Review checklist
- No predictor was selected because of its p-value.
- The reference level appears in the table caption.
- Residuals were inspected and any pattern addressed.
- Influential points were investigated rather than deleted.
- Model comparison used adjusted R-squared or held-out data.
