Unit 5 of 8 · about 5 hours · measure
Regression diagnostics, calibration and uncertainty
A small residual sum of squares is not an assumption check, and a low prediction loss is not a calibration certificate. This unit supplies the statistical properties that later model-evaluation tools try to estimate.
You'll be able to
- Derive residual orthogonality and conditional estimator covariance, then distinguish a fitting identity from evidence for regression assumptions.
- Audit residual curvature, changing spread, dependence and influential observations without claiming that plots prove exogeneity.
- Define probability calibration and separate calibration, resolution, outcome noise and parameter uncertainty.
Covers
Read
In this order, only the parts listed
0 of 4 done
- 14.310x Lecture 18: assumptions behind regression uncertaintyMIT 14.310x - Data Analysis for Social Scientists
Slides 8 to 22: full column rank, error covariance, least-squares estimator and its properties
Treat as fixed, or condition all error-moment assumptions on random . Unconditional alone does not establish exogeneity. Stop before -tests.
- 18.05 Class 26 reading: residual plotsMIT 18.05 - Inference practice
Sections 3.1 and 3.2, Residuals and Homoscedasticity, pp. 4 to 5
Use the plots, but correct p. 4's claim that heteroscedastic data must be transformed before least squares. OLS still exists; its usual homoscedastic standard errors need repair. Constant variance is an assumption about model errors, not identical variances of fitted residuals.
- Probability calibration, before recalibrationProbability calibration: the statistical property
Opening calibration definition, proper-scoring-rule note, and Section 1.16.1, Calibration curves
Stop before Section 1.16.2. Do not fit Platt scaling here; derive what calibration and the Brier components mean.
- Murphy: noise and parameter uncertaintyProbabilistic Machine Learning: An Introduction
April 18, 2025 online edition: Section 2.1.2, Types of uncertainty, pp. 33 to 34; Section 11.7.4, Computing the posterior predictive, pp. 406 to 407
Use the two variance terms, not a new Bayesian-regression implementation. More data can reduce parameter uncertainty within a model; it need not repair model misspecification.
Focus on
- Differentiating squared error gives at an OLS fit. With an intercept, fitted residuals sum to zero even under a wrong model. For fixed full-rank and , OLS is unbiased; covariance is , where . Only reduces it to .
- Look for curved residual means, a fan-shaped spread, serial dependence and high leverage. Fitted residual covariance is under homoscedastic independent errors, so fitted residuals are not iid. Plots can reveal failures but cannot prove causal exogeneity.
- Binary probability calibration is under the evaluation population. If and , expected Brier loss is . Reliability, resolution and outcome uncertainty are distinct; binning can hide within-bin failures.
- The law of total variance separates from . These are conditional outcome noise and posterior parameter uncertainty within the assumed model. Sampling variability of an estimator is a repeated-data property, and misspecification is not automatically represented by either variance term.
Common mistakes · 3
- Using zero training residual mean as evidence that errors have zero conditional mean. It is forced by the fitted intercept.
- Assuming homoscedasticity or normality is required to compute OLS. They support particular efficiency or inference claims, not existence of a least-squares fit.
- Calling a lower Brier loss proof of better calibration. A gain in resolution can outweigh worse reliability.
Try it yourself
Closed-book, before checking anything
float64 without random draws. Fit at with X = column_stack([ones(5), x]) and numpy.linalg.lstsq(X, y, rcond=None). The intercept/slope are approximately [2, 0], residuals [2, -1, -2, -1, 2], and the infinity norm of X.T @ residuals was 2.67e-15 or less; accept below 1e-12. On independent evaluation locations [-1.5, -0.5, 0.5, 1.5] with , residuals are [0.25, -1.75, -1.75, 0.25], so orthogonality did not fix curvature. Separately freeze probability predictions [0.2]*10 + [0.8]*10, then evaluate labels [1] + [0]*9 + [1]*9 + [0]. The two group frequencies are 0.1 and 0.9. Brier loss is 0.10 = reliability 0.01 - resolution 0.16 + uncertainty 0.25. Forecasts fixed at the group frequencies give 0.09; the calibrated but uninformative forecast 0.5 gives 0.25. Require absolute error below 1e-12 for these three Brier identities. This is a constructed population check, not a recalibrator fitted and scored on the same labels.Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.Which assumptions produce the usual OLS covariance formula?Answer
Fixed full-column-rank defines . The linear model gives . Conditional zero-mean errors give unbiasedness; finite error covariance gives . Homoscedastic uncorrelated errors make , yielding . Normality is needed for the familiar exact finite-sample normal/ inference, not this covariance algebra.
2.Can a calibrated forecast have poor discrimination?Answer
Yes. A constant forecast equal to the population prevalence is calibrated but separates no cases. For this balanced toy population, is calibrated and has Brier loss 0.25 versus 0.09 for the calibrated two-group forecast.
3.Derive the Brier cross-term cancellation and state its assumption.Answer
Write . Since , , so the cross term vanishes after conditioning on . Binary then gives . Finite moments hold because and lie in .
4.Why can more data shrink parameter uncertainty while uncertainty claims remain wrong?Answer
Posterior concentration can occur within a misspecified model. The assumed noise law, dependence structure or evaluation population can still be wrong. Small parameter variance does not validate the model or guarantee coverage under shift.
You're done when
You derive residual orthogonality and the Brier decomposition, pass both deterministic checks, and explain which statistical assumptions neither a good fit nor calibration can establish.
Only when you can do this without notes.
Leads to
Notes
Resources · 4 for this unit, 4 more in the section
- MIT 14.310x - Data Analysis for Social ScientistsMIT OpenCourseWare · primary
Follow lectures 11-15, 17-20 and 22 with matching slides and problem sets for inference, regression, causality and experiment design.
- MIT 18.05 - Inference practiceMIT OpenCourseWare · required
Use classes 17-20, 22-24 and 26 with their problem sets for tests, intervals, bootstrap and regression.
- Probabilistic Machine Learning: An IntroductionKevin P. Murphy · reference
Use the April 18, 2025 online edition: Sections 4.2.3 to 4.2.5, 4.5.1 and 4.6.4.1 for Bernoulli and Gaussian MLE/MAP; the definition and central intervals in 4.6.6; 2.1.2 and 11.7.4 for predictive uncertainty. Exercises 4.1 and 4.2 supply derivation practice.
- Probability calibration: the statistical propertyscikit-learn · reference
Read the opening calibration definition, the proper-scoring-rule note, and Section 1.16.1, Calibration curves. Stop before recalibration methods; the later Classical ML unit implements them.
Also in this section
- Causal Inference: What IfHernán & Robins · required
Read Chapters 1-3 and 6-8 for causal effects, DAGs, confounding, selection bias and identification reasoning.
- Patterns of trustworthy experimentationMicrosoft ExP · required
Read after the course to connect health checks, guardrails and statistical interpretation to production launch decisions.
- Always Valid InferenceJohari, Pekelis & Walsh · depth
Use the introduction and worked motivation to understand optional-stopping failure. Reproducing the theory is outside this gate.
- Permutation nulls and false discovery controlSciPy · reference
Read
permutation_testNotes, Unpaired statistics, for exchangeability and exact partitions;false_discovery_controlNotes and the named thrombolysis example for Bonferroni and Benjamini-Hochberg. Use as an independent implementation oracle, not as a substitute for stating assumptions.