Gaussian regression and exact inference
Use independent orthogonal Gaussian components to derive exact coefficient t statistics and distinguish mean from future-response uncertainty.
On this page
The question for today
What you’ll understand
- Derive the residual variance estimator and its degrees of freedom.
- Construct an exact t pivot under spherical Gaussian errors.
- Explain the extra uncertainty in a future observation.
The geometry of least squares gives a fitted component and a perpendicular residual component. Gaussian errors turn that perpendicularity into independence, which makes exact finite-sample inference possible. This lesson adds a full probability model to the earlier moment assumptions. Keep that addition visible: a t reference distribution does not arise solely because a regression program printed a coefficient and a standard error. Its exactness depends on a correct mean model, full rank, and a spherical Gaussian error vector.
A distributional assumption adds more than unbiasedness
Suppose the fixed design has rank p with , and is multivariate normal with mean zero and covariance , where σ² is positive. The errors are then independent Gaussian coordinates with common variance. Linear transformations preserve Gaussianity, so the least-squares coefficient vector is multivariate normal with its familiar mean and covariance. The residual vector is also Gaussian, but its coordinates generally are correlated and have unequal marginal variances because fitting removes model directions.
The fitted-error component is and the residual is . Their covariance is zero because the projection matrices multiply to zero. Joint Gaussianity upgrades this zero covariance to independence. Choose an orthonormal basis for the residual subspace: there are n−p independent Gaussian coordinates of variance σ². The residual sum of squares divided by σ² is therefore a chi-squared variable with n−p degrees of freedom. This argument identifies both the distribution and its dimensional origin.
Studentization removes the unknown scale
Define as residual sum of squares divided by n−p. It is unbiased for σ² under the correct spherical mean model, even without Gaussianity. Under the Gaussian model it is also independent of the coefficient estimator. For a nonzero coefficient contrast c, standardizing its estimation error by the true standard deviation gives a standard normal variable. Replacing σ with s divides that normal variable by the square root of an independent scaled chi-squared variable, producing a t distribution.
A confidence interval follows by retaining coefficient values whose t statistic lies between the chosen quantiles. Its confidence level refers to repeated intervals under the assumed model, not a posterior probability attached to a fixed coefficient. With very few residual degrees of freedom, estimating the noise scale is uncertain and t quantiles become large. Multiplying a normal critical value by a standard error can therefore substantially understate uncertainty in a small regression, even if the coefficient estimate itself looks stable.
Predicting a mean is different from predicting a new response
At a fixed new row , the fitted conditional mean has variance . A new response also includes fresh observation noise. If that error is independent of the training errors and follows the same Gaussian variance model, prediction-error variance adds another σ². The resulting interval is wider than a confidence interval for the mean. Merely reusing the mean standard error would omit irreducible uncertainty in the new measurement.
Exactness also presumes that the design, target contrast, and model were specified independently of response-driven selection. Choosing predictors after inspecting many fits and then quoting an ordinary single-model t interval ignores selection. Residual checks can reveal contradictions with assumptions, but a quiet plot cannot prove them. For heteroskedasticity, dependence, non-Gaussian small samples, or a changing deployment population, alternative variance estimates or inferential arguments must be justified rather than retaining the exact label automatically.
Work it through
Keep track of one residual degree of freedom
For an intercept-and-slope model with and , test the slope value zero by calculating the exact-model t statistic. Assume spherical Gaussian errors and a fixed design.
The fitted intercept is , the slope is , and the residual vector is . Its squared length is . There are residual degrees of freedom.
Thus . The slope diagonal of is , giving estimated slope variance and standard error .
Subtract the null slope zero and divide by that standard error: . The reference distribution under the null is , not a standard normal distribution.
The calculation is exact only under the stated Gaussian model. The single residual degree of freedom warns that the noise scale is very uncertain; the small training set does not justify narrow normal-based intervals.
The living notebook
Explore the model
Interactive lab · sampling
Separate an exact distribution from an approximation
Pause and Reset; set p=0.2 and n=5. Predict an asymmetric sample-mean distribution, then inspect the exact bars against the normal interval masses. Repeat from Reset with p=0.2 and n=80 to compare concentration and shape. Both settings must be entered again because controls retain elapsed time when edited. This is a Bernoulli sampling instrument, not a regression t-distribution simulator.
- Mean sample proportion
- 0.5
- Sample-mean variance
- 0.0125
- Uniform CDF error bound
- ≤ 0.1062
Exact binomial masses for the mean of n independent Bernoulli trials, compared with normal mass between adjacent half-count boundaries; normal tails outside the finite support remain outside the bars. Playback highlights outcomes, not random samples. The Berry–Esseen bound applies to standardized CDFs, not individual bars or continuity-corrected errors. At p = 0 or 1, normal comparison and that bound are disabled. Normal-CDF evaluation uses a numerical approximation with absolute error below 7.5×10⁻⁸ (at most 1.5×10⁻⁷ per interval, before rounding). Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forA reference distribution comes from a probability model; a convenient approximation is a separate claim.
Pause & reason
Check your understanding
Your turn
Try it yourself
In an intercept-only Gaussian model, observe . Find the fitted mean, residual degrees of freedom, s², and the standard error of the fitted mean. State the reference distribution for testing μ=3.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
The intercept-only design has one column. First square the deviations from the sample mean; do not divide their sum by n when estimating σ².
Compare with the solution
The mean is and residuals are , giving SSE=8. There are residual degrees of freedom, so . The fitted mean's estimated variance is and its standard error is . The null statistic is zero, with exact reference distribution under the assumed independent equal-variance Gaussian model.
Keep the idea
Take it with you
- Orthogonal Gaussian error components are independent.
- Residual rank determines the chi-squared and t degrees of freedom.
- Future-response intervals include fresh noise in addition to mean-estimation uncertainty.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.