Module 08 Activity
Scenario
Fit and interpret a simple relationship without overclaiming what it shows.
What you build
A statsmodels regression with its assumptions checked, its interval reported and its purpose stated.
Steps
- Plot the relationship before quoting any correlation, and check whether one point is driving it.
- Choose Pearson or Spearman deliberately, and treat a large gap between them as evidence of curvature.
- Fit with
smf.ols, report the slope with its confidence interval, and state the observed range of the predictor. - Inspect the residuals for pattern and report the residual standard deviation as well as R-squared.
- Decide whether the question needs
mean_ciorobs_cifromget_prediction(...).summary_frame(), and say which your figure shows. - State whether you are predicting or explaining, and list the confounders you could not measure.
Evidence to hand in
- The scatter plot and any influential point.
- The correlation with its method and interval.
- The fitted model with the slope interval and the observed range.
- The residual inspection and the residual SD.
- The interval you chose, with its justification.
- The prediction-or-explanation statement with unmeasured confounders.
Review checklist
- Every relationship was plotted before its correlation was quoted.
- The slope is reported with an interval and the observed range of x.
- Residuals were inspected for pattern, not just summarised.
- The figure states whether it shows a confidence or a prediction interval.
- Causal language is used only where the predictor was randomised.
