Simple Linear Regression: OLS Estimation, Gauss-Markov Theorem, Normal Equations & ANOVA Decomposition
Conditional expectation functions E[Y | X = x], population regression lines, and the classical Gauss-Markov assumptions; Ordinary Least Squares (OLS) derivation of slope beta_1_hat and intercept beta_0_hat; algebraic orthogonality properties of OLS residuals; Sampling distributions, unbiasedness, variances, and covariance of OLS estimators; unbiased estimation of error variance s^2 = SSE / (n - 2); Proof of the Gauss-Markov Theorem (BLUE property) in the bivariate case and equivalence with Maximum Likelihood under normal errors; Partitioning Total Sum of Squares (SST = SSR + SSE), coefficient of determination R^2, ANOVA F-test, andWorking-Hotelling confidence bands vs prediction intervals.
§1.1 Conditional Expectation Functions, Population Regression Lines, and Classical Gauss-Markov Assumptions
| Assumption Code | Mathematical Formulation | Statistical & Physical Interpretation |
|---|---|---|
| A1: Linearity in Parameters | $Y_i = \beta_0 + \beta_1 x_i + \varepsilon_i$ for $i=1,\dots,n$ | The true data-generating process is additive in the linear systematic signal $\beta_0 + \beta_1 x_i$ and the stochastic disturbance $\varepsilon_i$. |
| A2: Non-Degenerate Design Variation | $S_{xx} = \sum_{i=1}^n (x_i - \bar{x})^2 > 0$ ($n \ge 2$) | The predictor values $x_1, \dots, x_n$ are treated as fixed constants (or conditioned upon) and are not all identical; at least two $x_i$ values differ. |
| A3: Zero Conditional Mean (Exogeneity) | $\mathbb{E}[\varepsilon_i \mid x_1, \dots, x_n] = 0$ for all $i$ | The disturbances have zero mean at every covariate configuration, ensuring $\mathbb{E}[Y_i \mid x_i] = \beta_0 + \beta_1 x_i$ without omitted-variable bias. |
| A4: Homoscedasticity (Constant Variance) | $\text{Var}(\varepsilon_i \mid x_1, \dots, x_n) = \sigma^2 \in (0, \infty)$ | The dispersion of the stochastic error around the population regression line remains constant across all levels of the predictor $x_i$. |
| A5: Non-Autocorrelation (Uncorrelated Errors) | $\text{Cov}(\varepsilon_i, \varepsilon_j \mid x_1, \dots, x_n) = 0$ for $i \neq j$ | Disturbances across distinct experimental units or time points are pairwise linearly uncorrelated, implying $\text{Cov}(Y_i, Y_j) = 0$ for $i \neq j$. |
| A6: Gaussianity (Optional for Exact Inference) | $\varepsilon_i \overset{\text{iid}}{\sim} \mathcal{N}(0, \sigma^2)$ | Errors are independent and identically distributed normal variables, enabling exact finite-sample $t$-tests, $F$-tests, and confidence intervals. |
§1.2 Ordinary Least Squares (OLS) Derivation, Normal Equations, and Algebraic Orthogonality Properties
Given a realized sample of $n$ pairs $(x_1, y_1), \dots, (x_n, y_n)$, the true parameters $(\beta_0, \beta_1)$ and the true disturbances $\varepsilon_i$ are unobservable. If we propose candidate parameter values $(b_0, b_1) \in \mathbb{R}^2$, the resulting candidate fitted value for the $i$-th unit is $\hat{y}_i(b_0, b_1) = b_0 + b_1 x_i$, and the corresponding vertical deviation between the observed datum and the candidate line is $e_i(b_0, b_1) = y_i - (b_0 + b_1 x_i)$.
Proposed independently by Adrien-Marie Legendre (1805) and Carl Friedrich Gauss (1809) in the context of celestial mechanics and geodetic triangulation, the Principle of Ordinary Least Squares (OLS) selects the parameter estimators $(\hat{\beta}_0, \hat{\beta}_1)$ that minimize the sum of squared vertical deviations, denoted as the objective function $Q(b_0, b_1)$:
Because $Q(b_0, b_1)$ is a continuously differentiable, non-negative quadratic form in $(b_0, b_1)$, we obtain its stationary points by setting the first-order partial derivatives with respect to $b_0$ and $b_1$ equal to zero:
Dividing both equations by $-2$, rearranging terms, and replacing $(b_0, b_1)$ by the minimizers $(\hat{\beta}_0, \hat{\beta}_1)$ yields the celebrated OLS Normal Equations:
Dividing the first normal equation by $n$ gives $\hat{\beta}_0 + \hat{\beta}_1 \bar{x} = \bar{y}$, where $\bar{x} = \frac{1}{n}\sum_{i=1}^n x_i$ and $\bar{y} = \frac{1}{n}\sum_{i=1}^n y_i$ are the sample means. Consequently, the intercept estimator is explicitly linked to the slope estimator via:
Substituting $\hat{\beta}_0 = \bar{y} - \hat{\beta}_1 \bar{x}$ into the second normal equation yields:
To simplify these sums, we introduce the standard corrected sums of squares and cross-products notation:
where the identities $\sum (x_i - \bar{x}) \bar{x} = \bar{x} \sum (x_i - \bar{x}) = 0$ and $\sum (x_i - \bar{x}) \bar{y} = \bar{y} \sum (x_i - \bar{x}) = 0$ follow because deviations from the sample mean sum identically to zero. Under Assumption A2 ($S_{xx} > 0$), solving for $\hat{\beta}_1$ produces the closed-form OLS Slope Estimator:
where $r_{xy} = S_{xy} / \sqrt{S_{xx} S_{yy}}$ is the Pearson product-moment correlation coefficient and $s_x, s_y$ are the sample standard deviations. To confirm rigorously that $(\hat{\beta}_0, \hat{\beta}_1)$ corresponds to a strict global minimum rather than a saddle point, we inspect the $2 \times 2$ Hessian matrix of second partial derivatives of $Q(b_0, b_1)$:
The leading principal minor is $2n > 0$, and the determinant of $\mathbf{H}_Q$ is:
By Sylvester's criterion, $\mathbf{H}_Q$ is strictly positive definite everywhere on $\mathbb{R}^2$, proving that $(\hat{\beta}_0, \hat{\beta}_1)$ is the unique global minimizer of $Q(b_0, b_1)$.
Once $(\hat{\beta}_0, \hat{\beta}_1)$ are computed, we define the fitted values $\hat{y}_i = \hat{\beta}_0 + \hat{\beta}_1 x_i$ and the OLS residuals $e_i = y_i - \hat{y}_i$. Crucially, the normal equations impose six exact, distribution-free algebraic orthogonality identities on the residuals that hold for every dataset whenever an intercept is included:
1. Zero Sum of Residuals: $\sum_{i=1}^n e_i = 0$ (directly from the first normal equation).
2. Equality of Observed and Fitted Means: $\sum_{i=1}^n y_i = \sum_{i=1}^n \hat{y}_i \implies \bar{\hat{y}} = \bar{y}$.
3. Centroid Passage Property: Setting $x = \bar{x}$ in the fitted line gives $\hat{y}(\bar{x}) = \hat{\beta}_0 + \hat{\beta}_1 \bar{x} = (\bar{y} - \hat{\beta}_1 \bar{x}) + \hat{\beta}_1 \bar{x} = \bar{y}$, so the fitted regression line always passes exactly through the sample centroid $(\bar{x}, \bar{y})$.
4. Orthogonality to the Predictor: $\sum_{i=1}^n x_i e_i = 0$ (directly from the second normal equation), and consequently $\sum_{i=1}^n (x_i - \bar{x}) e_i = \sum x_i e_i - \bar{x} \sum e_i = 0$.
5. Orthogonality to the Fitted Values: $\sum_{i=1}^n \hat{y}_i e_i = \sum_{i=1}^n (\hat{\beta}_0 + \hat{\beta}_1 x_i) e_i = \hat{\beta}_0 \sum_{i=1}^n e_i + \hat{\beta}_1 \sum_{i=1}^n x_i e_i = 0$. In $n$-dimensional Euclidean space $\mathbb{R}^n$, the residual vector $\mathbf{e}$ is strictly orthogonal to the fitted response vector $\hat{\mathbf{y}}$.
6. Non-Zero Sum of Squares in Intercept-Free Regression: If a regression through the origin $Y_i = \beta_1 x_i + \varepsilon_i$ is fitted without an intercept $\beta_0$, the first normal equation is absent; only $\sum x_i e_i = 0$ holds, and $\sum_{i=1}^n e_i$ is generally non-zero.
Numerical Stability of Centered Computations and Geometric Orthogonality in Hilbert Space
From the standpoint of statistical computing (Course Stat H-312), the textbook algebraic formula for the corrected sum of squares, which subtracts the product of the sample size and the squared sample mean from the raw sum of squares, is notoriously susceptible to catastrophic floating-point cancellation when the sample standard deviation is small relative to the magnitude of the sample mean. Modern statistical software packages therefore evaluate the centered deviations first—or employ Welford's one-pass updating recursion and Householder QR orthogonal triangularization—before accumulating squared deviations and cross-products. Geometrically, the six orthogonality properties derived from the normal equations reflect the decomposition of Euclidean space into a two-dimensional estimation subspace spanned by the constant vector and the regressor vector, together with an orthogonal residual subspace of dimension two less than the sample size. Because the constant vector of ones lies inside the estimation plane, projecting the response vector onto that plane guarantees that the residual vector is perpendicular to the vector of ones, which is the geometric reason why the ordinary least squares residuals sum identically to zero.
§1.3 Sampling Distributions, Unbiasedness, Variances, Covariance, and Estimation of Error Variance
To evaluate the statistical precision of the Ordinary Least Squares estimators across repeated samples, we examine $\hat{\beta}_1$ and $\hat{\beta}_0$ as random variables generated by the stochastic vector $\mathbf{Y} = (Y_1, \dots, Y_n)^T$. A pivotal algebraic step is to express $\hat{\beta}_1$ and $\hat{\beta}_0$ as explicit linear combinations of the observations $Y_1, \dots, Y_n$. Define the deterministic regression weights $k_i$ by:
Because $\sum_{i=1}^n (x_i - \bar{x}) = 0$, the numerator of $\hat{\beta}_1$ simplifies to $S_{xy} = \sum_{i=1}^n (x_i - \bar{x})(Y_i - \bar{Y}) = \sum_{i=1}^n (x_i - \bar{x}) Y_i - \bar{Y} \sum_{i=1}^n (x_i - \bar{x}) = \sum_{i=1}^n (x_i - \bar{x}) Y_i$. Thus:
Before taking expectations and variances, we verify three fundamental algebraic identities satisfied by the weights $k_i$:
Substituting the structural model $Y_i = \beta_0 + \beta_1 x_i + \varepsilon_i$ into $\hat{\beta}_1 = \sum_{i=1}^n k_i Y_i$ yields the representation of $\hat{\beta}_1$ in terms of the true parameters and random errors:
Similarly, the intercept estimator $\hat{\beta}_0 = \bar{Y} - \hat{\beta}_1 \bar{x}$ can be written as a linear combination of $Y_1, \dots, Y_n$ with weights $w_i = \frac{1}{n} - k_i \bar{x}$:
Using Assumptions A3 ($\mathbb{E}[\varepsilon_i] = 0$), A4 ($\text{Var}(\varepsilon_i) = \sigma^2$), and A5 ($\text{Cov}(\varepsilon_i, \varepsilon_j) = 0$ for $i \neq j$), we immediately obtain the exact finite-sample expectations, variances, and covariance of the OLS estimators:
1. Unbiasedness of Slope and Intercept:
2. Sampling Variance of the Slope Estimator:
Notice the profound experimental design implication: $\text{Var}(\hat{\beta}_1)$ decreases when the error variance $\sigma^2$ is small and when the predictor values are widely dispersed around their mean (making $S_{xx}$ large).
3. Sampling Variance of the Intercept Estimator:
When $\bar{x}$ lies far from the origin $x = 0$, extrapolating the fitted line back to the vertical axis amplifies slope uncertainty by $\bar{x}^2$, inflating $\text{Var}(\hat{\beta}_0)$.
4. Covariance Between Intercept and Slope Estimators:
Because $\text{Cov}(\bar{Y}, \hat{\beta}_1) = \text{Cov}(\frac{1}{n}\sum Y_i, \sum k_j Y_j) = \frac{\sigma^2}{n} \sum_{i=1}^n k_i = 0$, the sample mean $\bar{Y}$ and the OLS slope $\hat{\beta}_1$ are strictly uncorrelated! Consequently:
If $\bar{x} > 0$, a random sample fluctuation that overestimates the slope ($\hat{\beta}_1 > \beta_1$) must pivot the line around the centroid $(\bar{x}, \bar{Y})$, tilting the left end downward and causing the intercept to be underestimated ($\hat{\beta}_0 < \beta_0$). Centering the predictor at $\tilde{x}_i = x_i - \bar{x}$ makes $\text{Cov}(\hat{\beta}_0^*, \hat{\beta}_1) = 0$.
In virtually all empirical applications, the disturbance variance $\sigma^2$ is unknown and must be estimated from the Error (or Residual) Sum of Squares, $\text{SSE} = \sum_{i=1}^n e_i^2 = \sum_{i=1}^n (Y_i - \hat{Y}_i)^2$. To find $\mathbb{E}[\text{SSE}]$, write each residual in centered form:
Squaring and summing over $i = 1, \dots, n$ yields the key computational identity:
Alternatively, substituting $Y_i - \bar{Y} = \beta_1(x_i - \bar{x}) + (\varepsilon_i - \bar{\varepsilon})$ and $\hat{\beta}_1 - \beta_1 = \sum k_i \varepsilon_i$ into $e_i = (\varepsilon_i - \bar{\varepsilon}) - (\hat{\beta}_1 - \beta_1)(x_i - \bar{x})$ gives:
Taking expectations, since $\mathbb{E}[\sum_{i=1}^n (\varepsilon_i - \bar{\varepsilon})^2] = (n - 1)\sigma^2$ and $\mathbb{E}[(\hat{\beta}_1 - \beta_1)^2] = \text{Var}(\hat{\beta}_1) = \sigma^2 / S_{xx}$:
Therefore, dividing $\text{SSE}$ by $n - 2$ degrees of freedom (accounting for the two estimated parameters $\hat{\beta}_0$ and $\hat{\beta}_1$) defines the unbiased estimator of error variance (also called Mean Square Error, $\text{MSE}$):
Experimental Design Principles for Maximizing Slope Precision
The analytical formulas for the sampling variances of the Ordinary Least Squares slope and intercept estimators provide immediate, actionable guidance for optimal experimental design before any physical measurements are collected. Because the variance of the slope estimator is inversely proportional to the corrected sum of squares of the predictor, an experimenter who is free to choose the operating levels of the explanatory variable within a bounded safe operating interval can minimize the variance of the estimated slope by placing half of the experimental runs at the lower boundary of the interval and the other half at the upper boundary. While such a two-point boundary design maximizes the spread of the predictor and thereby achieves the smallest possible standard error for the linear slope, it leaves no interior points to check whether the true conditional expectation function deviates from a straight line. Consequently, practical engineering and biometric calibration designs allocate the majority of runs toward the extremes of the predictor range to secure high precision for the slope while placing replicated center points near the sample mean to reduce intercept uncertainty and enable formal diagnostic testing for quadratic curvature.
§1.4 Proof of the Gauss-Markov Theorem (BLUE Property) and Maximum Likelihood Equivalence
Why should a statistician prefer the Ordinary Least Squares estimators $(\hat{\beta}_0, \hat{\beta}_1)$ over alternative linear combinations of the data, such as connecting the first and last observations or grouping observations into upper and lower halves (Wald's method of averages)? The definitive theoretical answer under Assumptions A1–A5 is provided by the Gauss–Markov Theorem.
Theorem 1.1 (The Gauss–Markov Theorem for Simple Linear Regression)
Under the classical Gauss–Markov assumptions A1–A5 ($\mathbb{E}[\varepsilon_i] = 0$, $\text{Var}(\varepsilon_i) = \sigma^2$, $\text{Cov}(\varepsilon_i, \varepsilon_j) = 0$ for $i \neq j$, and $S_{xx} > 0$), the Ordinary Least Squares estimators $\hat{\beta}_1$ and $\hat{\beta}_0$ are the unique Best Linear Unbiased Estimators (BLUE) of $\beta_1$ and $\beta_0$, respectively. That is, among all estimators that are both linear functions of $Y_1, \dots, Y_n$ and unbiased for the target parameter, the OLS estimators possess the strictly smallest variance.
Complete Mathematical Proof for $\hat{\beta}_1$:
Let $\tilde{\beta}_1$ be any arbitrary linear estimator of the slope $\beta_1$:
where $c_1, c_2, \dots, c_n$ are deterministic constants depending only on the fixed predictor values $x_1, \dots, x_n$. Taking the mathematical expectation of $\tilde{\beta}_1$ under Assumption A1 and A3:
For $\tilde{\beta}_1$ to be an unbiased estimator of $\beta_1$ identically for all $(\beta_0, \beta_1) \in \mathbb{R}^2$, the coefficients $c_i$ must satisfy the two linear unbiasedness constraints:
Now decompose each arbitrary weight $c_i$ by writing it as the sum of the OLS weight $k_i = (x_i - \bar{x})/S_{xx}$ and a discrepancy term $d_i$:
Because both $c_i$ and $k_i$ satisfy the unbiasedness constraints, the discrepancy weights $d_i$ automatically satisfy two orthogonality conditions:
Using these two identities, we evaluate the inner product between the OLS weights $k_i$ and the discrepancy weights $d_i$:
Now compute the sampling variance of the competing linear unbiased estimator $\tilde{\beta}_1$ under Assumptions A4 and A5:
Since the cross-product sum $\sum_{i=1}^n k_i d_i = 0$ vanishes identically and $\sigma^2 \sum_{i=1}^n k_i^2 = \text{Var}(\hat{\beta}_1)$, this simplifies to:
Because $\sigma^2 > 0$ and $\sum_{i=1}^n d_i^2 \ge 0$ is a sum of squares of real numbers, we have $\text{Var}(\tilde{\beta}_1) \ge \text{Var}(\hat{\beta}_1)$, with equality holding if and only if $d_i = 0$ for every $i = 1, \dots, n$, which means $c_i = k_i$ and $\tilde{\beta}_1 = \hat{\beta}_1$. An identical argument with $w_i = \frac{1}{n} - k_i \bar{x}$ and unbiasedness constraints $\sum c_i = 1, \sum c_i x_i = 0$ proves that $\hat{\beta}_0$ is the unique BLUE of $\beta_0$. More generally, for any scalar linear combination $\theta = a_0 \beta_0 + a_1 \beta_1$, the plug-in estimator $\hat{\theta} = a_0 \hat{\beta}_0 + a_1 \hat{\beta}_1$ is the unique BLUE of $\theta$.
Equivalence with Maximum Likelihood Estimation (MLE) and UMVUE under Normal Errors
Note that the Gauss–Markov Theorem requires no distributional assumption beyond finite second moments; however, its optimality is restricted to the class of linear unbiased estimators. When we add Assumption A6—that $\varepsilon_i \overset{\text{iid}}{\sim} \mathcal{N}(0, \sigma^2)$—then $Y_i \sim \mathcal{N}(\beta_0 + \beta_1 x_i, \sigma^2)$ independently, and the joint log-likelihood function for $\boldsymbol{\theta} = (\beta_0, \beta_1, \sigma^2)$ is:
For any fixed $\sigma^2 > 0$, maximizing $\ell(\beta_0, \beta_1, \sigma^2)$ with respect to $(\beta_0, \beta_1)$ is mathematically identical to minimizing the least-squares criterion $Q(\beta_0, \beta_1) = \sum (y_i - \beta_0 - \beta_1 x_i)^2$. Consequently:
Differentiating $\ell(\hat{\beta}_0, \hat{\beta}_1, \sigma^2)$ with respect to $\sigma^2$ yields $-\frac{n}{2\sigma^2} + \frac{\text{SSE}}{2(\sigma^2)^2} = 0$, giving the Maximum Likelihood Estimator of the error variance:
Thus, $\hat{\sigma}_{\text{MLE}}^2$ is biased downward in finite samples ($\mathbb{E}[\hat{\sigma}_{\text{MLE}}^2] = \frac{n-2}{n}\sigma^2$), though it is asymptotically unbiased and consistent as $n \to \infty$. Furthermore, under normal errors, the joint density belongs to a regular 3-parameter full-rank exponential family with complete sufficient statistic $\mathbf{T} = (\sum Y_i, \sum x_i Y_i, \sum Y_i^2)$. By the Lehmann–Scheffé Theorem, because $\hat{\beta}_0$, $\hat{\beta}_1$, and $s^2 = \text{SSE}/(n-2)$ are unbiased estimators that are functions solely of the complete sufficient statistic $\mathbf{T}$, they are the unique Uniformly Minimum Variance Unbiased Estimators (UMVUE) among all unbiased estimators—both linear and nonlinear!
Scope and Limitations of the Gauss-Markov Optimality Guarantee
Students of theoretical statistics must appreciate both the remarkable generality and the precise boundaries of the Gauss–Markov Theorem. On the one hand, the theorem is entirely non-parametric with respect to the shape of the error distribution: whether the disturbances follow a symmetric Gaussian bell curve, a skewed gamma distribution, or a discrete two-point distribution, the Ordinary Least Squares estimator achieves the minimum possible variance among all unbiased estimators that are linear combinations of the response observations. On the other hand, the restriction to linear and unbiased estimators is critical. When the error distribution possesses heavy tails—such as a Cauchy, Laplace, or contaminated normal distribution—nonlinear estimators such as the Least Absolute Deviations median regression estimator or Huber's M-estimator are no longer constrained by the Gauss–Markov bound and can achieve dramatically smaller asymptotic variance than Ordinary Least Squares. Similarly, in high-dimensional or collinear settings, biased linear estimators such as ridge regression deliberately sacrifice exact unbiasedness in order to achieve a smaller total Mean Squared Error than the Gauss–Markov Best Linear Unbiased Estimator.
§1.5 ANOVA Decomposition, Coefficient of Determination, and Exact Hypothesis Tests
| Source of Variation | Degrees of Freedom (df) | Sum of Squares (SS) | Mean Square (MS) | Expected Mean Square $\mathbb{E}[\text{MS}]$ | $F$-Statistic |
|---|---|---|---|---|---|
| Regression (Model) | $1$ | $\text{SSR} = \hat{\beta}_1^2 S_{xx}$ | $\text{MSR} = \text{SSR} / 1$ | $\sigma^2 + \beta_1^2 S_{xx}$ | $F = \dfrac{\text{MSR}}{\text{MSE}} \sim F_{1, n-2}$ |
| Residual (Error) | $n - 2$ | $\text{SSE} = S_{yy} - \hat{\beta}_1^2 S_{xx}$ | $\text{MSE} = s^2 = \dfrac{\text{SSE}}{n - 2}$ | $\sigma^2$ | — |
| Total (Corrected) | $n - 1$ | $\text{SST} = S_{yy}$ | — | — | — |
§1.6 Mean Response Confidence Intervals, Prediction Intervals, and Working-Hotelling Simultaneous Bands
A core objective of regression modeling is inference at a specified covariate value $x_0$. Statisticians must carefully distinguish between two fundamentally different inferential targets at $x = x_0$:
1. Estimating the Conditional Mean Response $\mu_{Y \mid x_0} = \mathbb{E}[Y \mid X = x_0] = \beta_0 + \beta_1 x_0$ (a deterministic population parameter representing the average outcome across all units with $X = x_0$).
2. Predicting an Individual Future Observation $Y_{\text{new}} = \beta_0 + \beta_1 x_0 + \varepsilon_{\text{new}}$ (a random variable representing a single new realization at $X = x_0$, where $\varepsilon_{\text{new}} \sim \mathcal{N}(0, \sigma^2)$ is independent of the training sample).
For both targets, the natural point estimator/predictor is the fitted value on the OLS line:
Because $\bar{Y}$ and $\hat{\beta}_1$ are uncorrelated ($\text{Cov}(\bar{Y}, \hat{\beta}_1) = 0$), the sampling variance of $\hat{Y}_0$ as an estimator of the conditional mean $\mu_{Y \mid x_0}$ is:
Therefore, replacing $\sigma$ by $s = \sqrt{\text{MSE}}$ yields the exact $100(1 - \alpha)\%$ Pointwise Confidence Interval for the Mean Response $\mathbb{E}[Y \mid X = x_0]$:
In contrast, when predicting a single new outcome $Y_{\text{new}} = \beta_0 + \beta_1 x_0 + \varepsilon_{\text{new}}$, the prediction error is the random variable $\psi = Y_{\text{new}} - \hat{Y}_0 = (\beta_0 + \beta_1 x_0 - \hat{Y}_0) + \varepsilon_{\text{new}}$. Its expectation is $\mathbb{E}[Y_{\text{new}} - \hat{Y}_0] = 0$, and because the future observation $Y_{\text{new}}$ is independent of the historical sample used to compute $\hat{Y}_0$, the variance of the prediction error is the sum of two variances:
Notice the extra $+1$ inside the bracket: it accounts for the irreducible stochastic variance $\sigma^2$ of the individual disturbance $\varepsilon_{\text{new}}$ around the true regression line! Even if the sample size $n \to \infty$ so that the regression line is known with absolute certainty ($\frac{1}{n} \to 0$ and $\frac{(x_0-\bar{x})^2}{S_{xx}} \to 0$), the prediction interval retains a positive asymptotic half-width $z_{\alpha/2} \sigma$, whereas the confidence interval for the mean collapses to zero width. The exact $100(1 - \alpha)\%$ Prediction Interval for a Single New Observation $Y_{\text{new}}$ at $x_0$ is:
If instead we predict the mean $\bar{Y}_{\text{new}, m}$ of $m$ independent future observations at $x_0$, the factor $1$ is replaced by $\frac{1}{m}$, yielding standard error $s\sqrt{\frac{1}{m} + \frac{1}{n} + \frac{(x_0 - \bar{x})^2}{S_{xx}}}$. Both the mean confidence interval and the prediction interval achieve their minimum width at the sample mean $x_0 = \bar{x}$ and flare outward along symmetric hyperbolic boundaries as $|x_0 - \bar{x}|$ increases, reflecting the growing danger of extrapolation away from the data center.
Working–Hotelling Simultaneous Confidence Band for the Entire Regression Line
A pointwise $95\%$ confidence interval covers $\mu_{Y \mid x_0}$ at a single pre-selected value $x_0$ with probability $0.95$, but if an analyst demands a simultaneous confidence band that encloses the entire true regression line $\beta_0 + \beta_1 x$ across all real numbers $x \in (-\infty, \infty)$ simultaneously with familywise confidence $1 - \alpha$, the critical multiplier $t_{\alpha/2, n-2}$ must be widened. Working and Hotelling (1929) proved that because a straight line in $\mathbb{R}^2$ is completely determined by the two parameters $(\beta_0, \beta_1)$, the supremum over all $x \in \mathbb{R}$ of the squared standardized deviation equals a quadratic form distributed as $2 F_{2, n-2}$:
where the Working–Hotelling multiplier is $W = \sqrt{2 F_{\alpha, \, 2, \, n-2}}$. Because $W = \sqrt{2 F_{\alpha, 2, n-2}} > \sqrt{F_{\alpha, 1, n-2}} = t_{\alpha/2, n-2}$, the simultaneous band is moderately wider than the pointwise confidence interval everywhere, guaranteeing simultaneous coverage across the entire domain of $x$.
Practical Calibration of Pointwise Intervals Versus Simultaneous Confidence Bands
Choosing appropriately between a pointwise confidence interval for the conditional mean, a Working–Hotelling simultaneous confidence band, and an individual prediction interval is essential in applied decision-making. When a regulatory agency or manufacturing engineer evaluates the expected long-run average yield at a single, pre-specified target operating condition, the pointwise Student-$t$ confidence interval provides exact nominal coverage. When a calibration curve is published as a reference chart to be consulted repeatedly across many different predictor values by future laboratories, the Working–Hotelling hyperbolic band must be employed so that the entire calibration line is contained within the envelope at the stated familywise confidence level. Finally, when certifying whether an individual patient's clinical biomarker or a single future industrial batch will fall within safety specifications, neither confidence band is sufficient; the analyst must use the wider prediction interval, which incorporates both the estimation uncertainty of the regression line and the irreducible random variation of the individual future realization.
Step-by-Step Regression Analysis Solutions
Three original questions connect calculations, definitions and interpretation. Open each solution to follow the reasoning.
A chemical process engineering laboratory at the University of Dhaka investigates the linear relationship between reactor operating temperature $x$ (in units of $10^\circ\text{C}$ above $100^\circ\text{C}$) and the percentage yield $Y$ of a purified catalytic polymer across $n = 10$ experimental runs. The summary statistics computed from the $n = 10$ runs are:
- Compute the corrected sums of squares and cross-products $S_{xx}, S_{yy}, S_{xy}$, and determine the Ordinary Least Squares estimates $\hat{\beta}_1$ and $\hat{\beta}_0$. Write down the fitted regression equation.
- Partition the Total Sum of Squares into $\text{SSR}$ and $\text{SSE}$, calculate the unbiased error variance estimate $s^2 = \text{MSE}$, the coefficient of determination $R^2$, and construct the complete ANOVA table. Test $H_0: \beta_1 = 0$ at significance level $\alpha = 0.05$ using both the $t$-test and the ANOVA $F$-test (note: $t_{0.025, 8} = 2.306$, $F_{0.05, 1, 8} = 5.318$).
- At a target operating temperature $x_0 = 8$, calculate the point prediction $\hat{y}_0$, the $95\%$ pointwise confidence interval for the mean yield $\mathbb{E}[Y \mid x_0 = 8]$, the $95\%$ Working–Hotelling simultaneous confidence band interval at $x_0 = 8$ (given $F_{0.05, 2, 8} = 4.459$), and the $95\%$ prediction interval for a single new reactor batch $Y_{\text{new}}$ at $x_0 = 8$.
With $n = 10$ observations, we first compute the sample means $\bar{x}$ and $\bar{y}$:
Next, we evaluate the corrected sums of squares and cross-products $S_{xx}, S_{yy},$ and $S_{xy}$:
Applying the closed-form Ordinary Least Squares formulas from Section 1.2 gives the slope and intercept estimates:
Therefore, the fitted linear regression equation is:
Each unit increase in $x$ ($10^\circ\text{C}$ increase in reactor temperature) increases the expected polymer yield by $2.50$ percentage points.
We partition the Total Sum of Squares $\text{SST} = S_{yy} = 660.0$ into the Regression Sum of Squares ($\text{SSR}$) and Error Sum of Squares ($\text{SSE}$):
With $n - 2 = 10 - 2 = 8$ error degrees of freedom, the unbiased estimate of the disturbance variance $\sigma^2$ and residual standard error $s$ are:
The coefficient of determination $R^2$ and sample correlation $r_{xy}$ are:
Thus, $75.76\%$ of the total variation in polymer yield is explained by the linear regression on reactor temperature. The standard errors of $\hat{\beta}_1$ and $\hat{\beta}_0$ are:
To test $H_0: \beta_1 = 0$ vs. $H_1: \beta_1 \neq 0$ at $\alpha = 0.05$:
- $t$-Test: $t = \frac{\hat{\beta}_1 - 0}{\text{SE}(\hat{\beta}_1)} = \frac{2.50}{0.50} = 5.00$. Since $|t| = 5.00 > t_{0.025, 8} = 2.306$, we reject $H_0$.
- ANOVA $F$-Test: $F = \frac{\text{MSR}}{\text{MSE}} = \frac{500.0 / 1}{160.0 / 8} = \frac{500.0}{20.0} = 25.00 = t^2$. Since $F = 25.00 > F_{0.05, 1, 8} = 5.318$, both tests identically confirm a highly statistically significant linear relationship.
At the target covariate level $x_0 = 8$, the fitted point prediction is:
Notice that $x_0 - \bar{x} = 8.0 - 5.0 = 3.0$, so $(x_0 - \bar{x})^2 / S_{xx} = 9.0 / 80.0 = 0.1125$.
1. Standard Error and $95\%$ Pointwise Confidence Interval for $\mathbb{E}[Y \mid x_0 = 8]$:
2. $95\%$ Working–Hotelling Simultaneous Confidence Band at $x_0 = 8$:
The Working–Hotelling critical multiplier is $W = \sqrt{2 F_{0.05, 2, 8}} = \sqrt{2(4.459)} = \sqrt{8.918} \approx 2.9863$.
3. $95\%$ Prediction Interval for a Single Future Batch $Y_{\text{new}}$ at $x_0 = 8$:
Comparing the three half-widths ($\pm 4.754$ for the pointwise mean CI, $\pm 6.157$ for the simultaneous Working–Hotelling band, and $\pm 11.356$ for the individual prediction interval) illustrates how individual batch variability $\sigma^2 = 20.0$ dominates single-observation prediction uncertainty.
In certain physical and biometric calibration settings (such as spectrophotometric absorbance obeying the Beer–Lambert law where zero concentration implies zero absorbance), theory dictates that the population regression line passes strictly through the origin ($\beta_0 = 0$), yielding the Regression Through the Origin (RTO) model:
where $\mathbb{E}[\varepsilon_i] = 0$, $\text{Var}(\varepsilon_i) = \sigma^2$, $\text{Cov}(\varepsilon_i, \varepsilon_j) = 0$ ($i \neq j$), and $\sum_{i=1}^n x_i^2 > 0$.
- Derive the Ordinary Least Squares estimator $\tilde{\beta}_1$ of $\beta_1$ under the zero-intercept model, prove that $\tilde{\beta}_1$ is unbiased for $\beta_1$ when $\beta_0 = 0$, and derive its exact variance $\text{Var}(\tilde{\beta}_1)$.
- Prove via the Gauss–Markov method that $\tilde{\beta}_1$ is the unique Best Linear Unbiased Estimator (BLUE) of $\beta_1$ when $\beta_0 = 0$, and compare $\text{Var}(\tilde{\beta}_1)$ against the variance $\text{Var}(\hat{\beta}_1) = \sigma^2 / S_{xx}$ of the full intercept-included OLS slope estimator.
- Show that for the RTO residuals $\tilde{e}_i = Y_i - \tilde{\beta}_1 x_i$, the weighted orthogonality $\sum_{i=1}^n x_i \tilde{e}_i = 0$ holds, but $\sum_{i=1}^n \tilde{e}_i \neq 0$ in general. Finally, derive the bias and Mean Squared Error of $\tilde{\beta}_1$ if the true data-generating process actually has a non-zero intercept $\beta_0 \neq 0$.
To estimate $\beta_1$ in the zero-intercept model $Y_i = \beta_1 x_i + \varepsilon_i$, we minimize the single-parameter sum of squares objective function:
Differentiating with respect to $b_1$ and setting the derivative equal to zero gives the single normal equation:
Since $\sum_{i=1}^n x_i^2 > 0$ (and $d^2 Q_0 / d b_1^2 = 2 \sum x_i^2 > 0$), the unique global minimizer is:
Substituting $Y_i = \beta_1 x_i + \varepsilon_i$ into this expression yields:
Taking expectations and variances under $\mathbb{E}[\varepsilon_i] = 0$ and $\text{Cov}(\varepsilon_i, \varepsilon_j) = \sigma^2 \delta_{ij}$:
Let $\beta_1^* = \sum_{i=1}^n a_i Y_i$ be any linear estimator of $\beta_1$. Under the true model $Y_i = \beta_1 x_i + \varepsilon_i$, its expectation is $\mathbb{E}[\beta_1^*] = \beta_1 \sum_{i=1}^n a_i x_i$, so unbiasedness requires the single constraint $\sum_{i=1}^n a_i x_i = 1$. Let $a_i^* = x_i / \sum_{j=1}^n x_j^2$ be the RTO weights and define $d_i = a_i - a_i^*$. Then $\sum_{i=1}^n d_i x_i = 1 - 1 = 0$, which implies $\sum_{i=1}^n a_i^* d_i = (\sum d_i x_i)/(\sum x_j^2) = 0$. Consequently:
proving that $\tilde{\beta}_1$ is the unique BLUE when $\beta_0 = 0$. Comparing $\text{Var}(\tilde{\beta}_1)$ to the variance $\text{Var}(\hat{\beta}_1) = \sigma^2 / S_{xx}$ of the intercept-included estimator, since $\sum_{i=1}^n x_i^2 = S_{xx} + n \bar{x}^2 \ge S_{xx}$:
The relative efficiency ratio is $\frac{\text{Var}(\tilde{\beta}_1)}{\text{Var}(\hat{\beta}_1)} = \frac{S_{xx}}{S_{xx} + n \bar{x}^2} < 1$ whenever $\bar{x} \neq 0$, because knowing $\beta_0 = 0$ anchors the line at $(0,0)$ rather than estimating a second parameter.
For the RTO residuals $\tilde{e}_i = Y_i - \tilde{\beta}_1 x_i$, the normal equation directly implies:
so $\tilde{\mathbf{e}}$ is orthogonal to $\mathbf{x}$ and $\tilde{\hat{\mathbf{y}}} = \tilde{\beta}_1 \mathbf{x}$, and $\mathbb{E}[\sum \tilde{e}_i^2] = (n - 1)\sigma^2$. However, summing the raw residuals gives:
which is non-zero unless $(\bar{x}, \bar{Y})$ happens to lie on the line through the origin. Because $\sum \tilde{e}_i \neq 0$, the uncentered decomposition $\sum (Y_i - \bar{Y})^2$ does not partition cleanly into $\sum (\tilde{\hat{Y}}_i - \bar{Y})^2 + \sum \tilde{e}_i^2$ (instead, $\sum Y_i^2 = \sum \tilde{\hat{Y}}_i^2 + \sum \tilde{e}_i^2$).
Finally, suppose the true data-generating process actually has a non-zero intercept $Y_i = \beta_0 + \beta_1 x_i + \varepsilon_i$ with $\beta_0 \neq 0$. Then:
The Mean Squared Error of the misspecified zero-intercept estimator is therefore:
Whenever $|\beta_0|$ is large relative to $\sigma$, the squared specification bias $\text{Bias}(\tilde{\beta}_1)^2$ overwhelms the variance reduction, explaining why statisticians retain the intercept $\beta_0$ unless physical theory guarantees $\beta_0 = 0$ with certainty.
Consider the normal simple linear regression model $Y_i = \beta_0 + \beta_1 x_i + \varepsilon_i$ ($i = 1, \dots, n$) where $\varepsilon_i \overset{\text{iid}}{\sim} \mathcal{N}(0, \sigma^2)$ and $S_{xx} > 0$.
- Prove analytically that the sample mean $\bar{Y}$ and the OLS slope estimator $\hat{\beta}_1$ are statistically independent random variables, and derive the exact $2 \times 2$ variance-covariance matrix $\text{Cov}\!\begin{pmatrix} \hat{\beta}_0 \\ \hat{\beta}_1 \end{pmatrix}$ by writing $\begin{pmatrix} \hat{\beta}_0 \\ \hat{\beta}_1 \end{pmatrix}$ as a linear transformation of $\begin{pmatrix} \bar{Y} \\ \hat{\beta}_1 \end{pmatrix}$.
- Derive the correlation coefficient $\rho(\hat{\beta}_0, \hat{\beta}_1)$ between the OLS intercept and slope estimators as an explicit function of $\bar{x}$, $n$, and $S_{xx}$.
- Inverse Regression (Calibration Problem): Suppose an analytical chemist observes a known benchmark response $y^*$ (or wishes to find the horizontal intercept $x^* = -\beta_0 / \beta_1$ where $\mathbb{E}[Y \mid x^*] = 0$). Using the pivotal quantity $W(x^*) = \hat{\beta}_0 + \hat{\beta}_1 x^* - y^*$, derive Fieller's exact $100(1-\alpha)\%$ confidence set for the unknown true covariate $x^* = (y^* - \beta_0)/\beta_1$.
Write $\bar{Y} = \sum_{i=1}^n a_i Y_i$ with $a_i = \frac{1}{n}$ and $\hat{\beta}_1 = \sum_{i=1}^n k_i Y_i$ with $k_i = \frac{x_i - \bar{x}}{S_{xx}}$. Because $Y_1, \dots, Y_n$ are independent normal random variables, any pair of linear combinations $(\bar{Y}, \hat{\beta}_1)$ follows a bivariate normal distribution. Their covariance is:
Because jointly normal random variables with zero covariance are statistically independent, $\bar{Y}$ and $\hat{\beta}_1$ are independent:
Now express $\begin{pmatrix} \hat{\beta}_0 \\ \hat{\beta}_1 \end{pmatrix}$ as a linear transformation of $\begin{pmatrix} \bar{Y} \\ \hat{\beta}_1 \end{pmatrix}$:
By standard multivariate normal covariance propagation, $\text{Cov}\!\begin{pmatrix} \hat{\beta}_0 \\ \hat{\beta}_1 \end{pmatrix} = \mathbf{A} \text{Cov}\!\begin{pmatrix} \bar{Y} \\ \hat{\beta}_1 \end{pmatrix} \mathbf{A}^T$:
From the $2 \times 2$ covariance matrix derived in Step 1, we divide the off-diagonal covariance $\text{Cov}(\hat{\beta}_0, \hat{\beta}_1)$ by the square root of the product of the diagonal variances:
Notice that $\rho(\hat{\beta}_0, \hat{\beta}_1)$ always has the opposite sign of $\bar{x}$, approaches $-1$ as $\bar{x} / s_x \to +\infty$, and equals zero if and only if the predictor is centered so that $\bar{x} = 0$.
Let $y^* = \beta_0 + \beta_1 x^*$ be the target expected response at the unknown true covariate value $x^* = (y^* - \beta_0)/\beta_1$. While the natural point estimator is $\hat{x}^* = (y^* - \hat{\beta}_0)/\hat{\beta}_1 = \bar{x} + (y^* - \bar{Y})/\hat{\beta}_1$, this is a ratio of two normal random variables whose exact distribution is heavy-tailed (Cauchy-like). Instead of relying on an approximate delta-method expansion, Fieller's method constructs an exact linear normal pivot:
Because $y^* = \beta_0 + \beta_1 x^*$, we have $\mathbb{E}[W(x^*)] = \beta_0 + \beta_1 x^* - y^* = 0$, and by the independence of $\bar{Y}$ and $\hat{\beta}_1$:
Since $W(x^*)$ is normal and independent of $s^2 = \text{MSE}$, the standardized ratio follows an exact Student $t_{n-2}$ distribution:
Setting $T(x^*)^2 \le t_{\alpha/2, n-2}^2$ and letting $u = x^* - \bar{x}$ and $d = y^* - \bar{Y}$ yields the quadratic inequality in $u$:
Define the slope significance ratio $g = \frac{t_{\alpha/2, n-2}^2 s^2}{\hat{\beta}_1^2 S_{xx}} = \frac{t_{\alpha/2, n-2}^2}{t_{\text{slope}}^2}$. Notice that $g < 1$ if and only if $H_0: \beta_1 = 0$ is rejected at level $\alpha$. Rearranging the inequality into standard quadratic form in $u = x^* - \bar{x}$:
When $g < 1$ (so the slope is significantly non-zero), solving this quadratic equation gives Fieller's exact $100(1-\alpha)\%$ confidence interval for $x^*$:
When $g \to 0$ (high slope precision), Fieller's interval reduces smoothly to the delta-method approximation; when $g \ge 1$ ($\beta_1$ is not statistically distinguishable from zero), the confidence set becomes the complement of a finite interval or the entire real line $(-\infty, \infty)$, reflecting the physical fact that a horizontal line cannot be inverted uniquely.