Linear Regression Assumptions

What must hold for a regression's standard errors, intervals and tests to mean what they say. Errors versus residuals, leverage, the assumptions in order of importance, residual plots and Q-Q plots on a diabetes study and Anscombe's quartet, a seeded simulation of how often the textbook interval covers the true slope when each assumption fails, and the remedies.

A regression's standard errors, intervals and tests assume errors that average zero on the line (linearity), are independent and have constant variance; normality matters only for exact small-sample $t$ intervals and for prediction intervals. Validity and representativeness come first, and no residual plot can check them. In a seeded simulation (10,000 datasets of $n = 30$), the textbook 95% slope interval covered 0.951 when all assumptions held, 0.921 when the variance grew with $x$ (0.937 with HC3 standard errors), only 0.497 with AR(1) errors correlated in time, and 0.950 and 0.954 for heavy-tailed and skewed errors; the slope stayed unbiased throughout. For progression on BMI in 442 diabetes patients the residuals are nearly normal and mildly heteroscedastic (HC3 standard error 0.6181 against 0.6738).

A least-squares line can be computed for any set of points with at least two distinct input values. The formulas of Simple Linear Regression always return a slope, an intercept, standard errors and a $p$-value, whether or not the data resemble the model those numbers assume. The line itself is defined without any assumptions: it is the line with the smallest residual sum of squares. But everything said about its uncertainty, the standard errors, confidence intervals, prediction intervals and tests, is derived from a model of how the data were generated, and is only as good as that model.

This article states the assumptions, shows how to check each one with plots of the residuals, and measures what goes wrong when one fails. The running examples are the regression of disease progression on body mass index (BMI) for 442 diabetes patients (Efron, Hastie, Johnstone and Tibshirani, 2004), whose least-squares line is $\widehat{\text{progression}} = -117.77 + 10.233 \times \text{BMI}$, and Anscombe's (1973) four datasets, introduced in Introduction to Regression. A seeded simulation then shows, for each kind of failure, how often the textbook 95% interval for the slope actually contains the true slope.

The model behind the numbers

Simple linear regression assumes the data arose as

$$y_i = \beta_0 + \beta_1 x_i + \varepsilon_i, \qquad i = 1, \dots, n,$$

where $\beta_0$ and $\beta_1$ are fixed unknown coefficients and $\varepsilon_i$ is the error for observation $i$. The standard assumptions concern those errors:

  1. Linearity. The errors have mean zero at every value of $x$; equivalently, the average of $y$ at each $x$ lies on the straight line $\beta_0 + \beta_1 x$.
  2. Independence. The errors are independent of one another (in the weakest form, uncorrelated).
  3. Constant variance. The errors have the same variance $\sigma^2$ at every value of $x$. This is called homoscedasticity, and its failure heteroscedasticity.
  4. Normality. The errors follow a normal distribution.

The first three are what the standard error formulas use: James, Witten, Hastie and Tibshirani (2021, §3.1.2) state that $\mathrm{SE}(b_1) = \sigma/\sqrt{S_{xx}}$ requires errors that are uncorrelated with a common variance. The fourth is what turns a standard error into an exact $t$ interval or $p$-value in small samples (The Normal Linear Model proves it). The initials give the common mnemonic LINE.

Errors are not residuals

The assumptions are about the errors $\varepsilon_i$, the deviations from the true line, which are never observed. What can be computed are the residuals $e_i = y_i - \hat{y}_i$, the deviations from the fitted line. Residuals are the evidence about the errors, but they are not a sample of them, and they behave differently in two ways.

First, the residuals are constrained. The normal equations force $\sum e_i = 0$ and $\sum x_i e_i = 0$, so the residuals always average exactly zero and are always uncorrelated with $x$, whatever the errors are like. That is why the mean-zero part of the linearity assumption cannot be checked by averaging the residuals; it can only be checked by looking for a pattern in them.

Second, residuals do not all have the same variance even when the errors do. Under the model, $\mathrm{Var}(e_i) = \sigma^2 (1 - h_i)$ (Proposition 1 of Leverage, Influence and Residual Diagnostics), where

$$h_i = \frac{1}{n} + \frac{(x_i - \bar{x})^2}{S_{xx}}$$

is the leverage of observation $i$, with $S_{xx} = \sum (x_j - \bar{x})^2$. Leverage measures how far an observation's input lies from the center of the inputs. A point with high leverage pulls the fitted line toward itself, so its residual is small even when its error is large. Leverages always lie between $1/n$ and 1, and in simple regression they average $2/n$ (James et al., 2021, §3.3.3). The Geometry of Least Squares proves the bounds (its Theorem 2), and Worked problem 1 below proves the average. For the diabetes data the average is $2/442 = 0.0045$, and the largest is 0.0314, for the patient with the highest BMI, 42.2. In the fourth of Anscombe's sets, the single point at $x = 19$ has leverage 1.000: the line must pass through it exactly, its residual is zero, and nothing in the residuals reveals how much it controls the fit.

Dividing each residual by its own estimated standard deviation gives the studentized residual $e_i / (\hat{\sigma}\sqrt{1 - h_i})$, where $\hat{\sigma}$ is the residual standard error, which puts all residuals on a common scale. James et al. (2021, §3.3.3) suggest treating studentized residuals beyond 3 in absolute value as possible outliers. The diabetes model has none; 13 of its 442 exceed 2, where about 20 (4.55% of 442) would be expected if the errors were normal. That expectation treats each studentized residual as standard normal, a close approximation with 440 degrees of freedom; the diagnostics article derives the exact distribution. Fewer large residuals than expected matches the short tails found below.

In order of importance

The four assumptions are not equally important, and they are not the only ones. Gelman, Hill and Vehtari (2020, §11.1) list the assumptions of regression "in decreasing order of importance" and put two before any of the four above:

  1. Validity. The data must answer the question. The outcome must measure what is of interest, the model should include the relevant predictors, and it must apply to the cases it will be used for.
  2. Representativeness. The sample must represent the population of interest, in the sense that the distribution of the outcome given the inputs is the same. In their words, "selection on x does not interfere with inferences from the regression model, but selection on y does".
  3. Additivity and linearity, which they call the most important mathematical assumption.
  4. Independence of errors.
  5. Equal variance of errors.
  6. Normality of errors.

No residual plot can detect a failure of the first two. A study of patients at risk of a disease may not describe healthy people, whatever the diagnostics say. For the diabetes data, all 442 participants were diabetes patients, so the line describes how progression varies with BMI among diabetes patients like them, and nothing more.

Among the four mathematical assumptions, the order matters in practice. If the form is wrong, the model is wrong, and repairing its standard errors will not help. If the errors are dependent, every statement about uncertainty is suspect. Unequal variance distorts uncertainty more mildly. Normality matters least of all, except for predicting individual values. The simulation below puts numbers on the last three of these statements; the cost of a wrong form is shown by Anscombe's second set below and by the overfitting experiment of Multiple Linear Regression.

Diagnostic plots

Two plots do most of the work. The residuals-versus-fitted plot puts $\hat{y}_i$ on the horizontal axis and $e_i$ on the vertical, with a reference line at zero. With one input, plotting against $x$ shows the same pattern (mirrored left to right when the slope is negative), because each fitted value is a linear function of $x$; but plotting against the fitted values carries over unchanged to models with many inputs. If the assumptions hold, the points form a horizontal band of even width around zero, with no curve, no funnel and no clusters. The normal Q-Q plot sorts the residuals and plots them against the quantiles a normal sample of the same size would have; if the residuals are close to normal, the points fall close to a straight line.

Residual plots from four synthetic datasets, each fitted with a straight line, showing the characteristic sign of each failure. A U-shape means the form is wrong. A funnel means the variance grows with the fitted value. Long runs of residuals on one side of zero, plotted in time order, mean the errors are correlated. A few residuals far from the rest suggest heavy-tailed errors.
Residual plots from four synthetic datasets, each fitted with a straight line, showing the characteristic sign of each failure. A U-shape means the form is wrong. A funnel means the variance grows with the fitted value. Long runs of residuals on one side of zero, plotted in time order, mean the errors are correlated. A few residuals far from the rest suggest heavy-tailed errors.

Linearity

The residuals-versus-fitted plot is the main check for linearity. If the true relationship curves, the line is too high in some regions and too low in others, and the residuals trace the curve that the line missed. In the second of Anscombe's sets, which follows a parabola exactly, the residuals are $1.14, 1.14, -0.76, 1.27, \dots$, positive in the middle of the input range and negative at both ends.

A violation of linearity biases every prediction in a way that depends on where the input is, and makes the slope a summary of something that is not a straight line. The remedy is to change the model, not its standard errors: transform the input or the output (taking logarithms is the most common), add a squared term, or use a more flexible model. Multiple Linear Regression fits Anscombe's second set exactly with a quadratic.

Independence

Errors are dependent when observations share something the model does not include. Measurements over time are the classic case: if this month's error is positive, next month's is likely to be positive too, a pattern called tracking (James et al., 2021, §3.3.3). Observations clustered in space, repeated measurements of the same person, and members of the same family or school are other common cases. Gelman et al. (2020, §11.1) note that the independence assumption is violated in time series, spatial and multilevel settings.

Dependence is usually a property of how the data were collected, so the first check is to ask how they were collected. When the observations have a natural order, such as time, plotting the residuals in that order shows tracking as long runs above or below zero. The diabetes data have no documented order; the correlation between each residual and the next, in the order of the file, is 0.075.

Positively correlated errors carry less information than the same number of independent ones, because each observation partly repeats its neighbor. The standard errors, which assume independence, are then too small, and intervals too narrow (James et al., 2021, §3.3.3). The simulation below shows how large the effect can be. Remedies model the dependence: time-series models for ordered data (regression with ARMA errors in Autoregressive and Moving Average Models), and standard errors or mixed models that account for clusters. A bootstrap must respect the same dependence (Resampling Dependent and Clustered Data).

Constant variance

When the spread of the outcome grows with its level, the residuals-versus-fitted plot fans out. This is common for outcomes that are counts, amounts of money or concentrations, where larger values vary more in absolute terms. James et al. (2021, §3.3.3) give the funnel shape as the sign of heteroscedasticity and suggest transforming the response, for example with a logarithm.

Diagnostics for progression on BMI. Left: residuals against fitted values, with yellow bars at plus and minus two standard deviations of the residuals in each third of the fitted values. The spread is narrower in the lowest third, partly because progression cannot fall below 25 (dashed line), which caps the negative residuals there. Right: the normal Q-Q plot; the points follow the line closely, with slightly short tails.
Diagnostics for progression on BMI. Left: residuals against fitted values, with yellow bars at plus and minus two standard deviations of the residuals in each third of the fitted values. The spread is narrower in the lowest third, partly because progression cannot fall below 25 (dashed line), which caps the negative residuals there. Right: the normal Q-Q plot; the points follow the line closely, with slightly short tails.

The diabetes residuals show mild heteroscedasticity. Split into thirds by fitted value, their standard deviation is 49.6 for fitted values from 66.4 to 128.8, 67.9 for the middle third, and 68.4 for fitted values from 167.7 to 314.1. Part of the reason is visible in the plot: the smallest progression in the data is 25, so a patient with a low fitted value cannot have a large negative residual. The residual for a fitted value $\hat{y}$ can be no lower than $25 - \hat{y}$, the dashed line. Taking the logarithm of progression does not even out the spread here: the standard deviations by thirds become 0.457, 0.528 and 0.415.

With unequal variance, the least-squares line is still unbiased, but it is no longer the most precise estimate available (The Gauss–Markov Theorem explains why), and the usual standard error is wrong because it averages the variance over all observations. White (1980) gave an estimator of the coefficients' covariance matrix that remains consistent when the errors are heteroscedastic, without a model of how the variance changes. It replaces the single $\hat{\sigma}^2$ with each observation's own squared residual. A variant with better behavior in small samples, called HC3, scales each squared residual by $1/(1 - h_i)^2$; it is a simplified form of the jackknife estimator that MacKinnon and White (1985) studied. For the diabetes slope, the classical standard error is 0.6738 and the HC3 standard error 0.6181, so the mild fan makes little difference to the conclusion. Worked problem 2 writes the HC3 formula out for one input and explains why it comes out smaller here. If the form of the variance is known, weighted least squares, which gives noisier observations less weight, is more efficient (Gelman et al., 2020, §11.1). Aitken's theorem proves it: with known relative variances, the weighted estimator is the best linear unbiased one (Theorem 4 of The Gauss–Markov Theorem).

Normality

The normal Q-Q plot of the diabetes residuals is close to a straight line; the correlation between the sorted residuals and the normal quantiles is 0.9958. The residuals have skewness 0.156 and excess kurtosis $-0.547$, meaning slightly shorter tails than a normal distribution. A Q-Q plot whose points fall below the line at the low end and rise above it at the high end indicates heavy tails, more extreme residuals than a normal distribution produces; one that bows to one side of the line along its whole length indicates skewness.

Normality is the least important assumption for the slope. Least squares does not need it to find the line. The estimated slope is a weighted sum of the errors, $b_1 - \beta_1 = \sum_i w_i \varepsilon_i$ with $w_i = (x_i - \bar{x})/S_{xx}$, and a weighted sum of many independent errors in which no single weight dominates is close to normal in moderate samples, whatever the errors' distribution. That is a central limit theorem for weighted sums. This site proves only the equal-weight case (Convergence in Distribution and the Proof of the Central Limit Theorem). For this article the claim rests on the simulation below, which shows intervals for the slope keeping their coverage under two non-normal error distributions at $n = 30$, and on the NHANES experiment of The Normal Linear Model. Gelman et al. (2020, §11.1) go further: for estimating the regression line, "the assumption of normality is typically barely important at all", and they do not recommend routine normality diagnostics. Normality matters more for prediction intervals, which describe the spread of individual outcomes, not of an average. A 95% prediction interval built from a normal distribution will be wrong for skewed or heavy-tailed errors no matter how large the sample. For the diabetes model, 426 of the 442 patients (96.4%) fall inside their own 95% prediction intervals, consistent with the residuals' near-normal shape.

Outliers and influential points

An outlier is an observation whose output is far from the model's prediction, and a high-leverage point is one whose input is far from the others. A point that is both can change the fit substantially (James et al., 2021, §3.3.3). Leverage, Influence and Residual Diagnostics measures that change, with Cook's distance. In the third of Anscombe's sets, ten points lie exactly on one line and the eleventh, at $(13, 12.74)$, lies well above it. With all eleven, the fitted line is $\hat{y} = 3.00 + 0.500\,x$. Without that point it is $\hat{y} = 4.0056 + 0.3454\,x$, the line through the other ten. With all eleven the slope is 0.4997 to four decimals, so one point in eleven made the slope 44.7% steeper than the other ten imply.

An outlier is a reason to investigate, not to delete. It may be a recording error, which should be corrected; a case from a different population, which may belong in a separate analysis; or a genuine extreme value, which belongs in the data. Reporting the fit with and without it is often the honest answer.

What a failure costs: a simulation

Correlated errors matter most: in the simulation below they cut the coverage of a nominal 95% interval to about one half. Unequal variance costs a few points of coverage, and non-normal errors cost almost nothing. The comparison is made by simulating data where the truth is known. Each scenario below generates 10,000 datasets of $n = 30$ points with inputs drawn uniformly between 0 and 1 and a true line $y = 1 + 2x$, fits a least-squares line to each, and records whether the usual 95% interval for the slope, $b_1 \pm t_{0.975,\,28}\,\mathrm{SE}(b_1)$, contains the true slope 2. If the interval is right, it should do so 95% of the time. With 10,000 datasets from one seed (2026), the Monte Carlo standard error of a coverage near 0.95 is $\sqrt{0.95 \times 0.05/10{,}000} = 0.002$, so coverages that differ by less than about 0.005 cannot be told apart. The errors differ by scenario:

  • All assumptions hold: independent standard normal errors.
  • Variance grows with $x$: normal errors with standard deviation $2x$.
  • Errors correlated in time: the inputs are sorted, standing for time, and the errors follow a first-order autoregressive process, each error 0.8 times the previous one plus fresh noise, scaled to variance 1.
  • Heavy tails: errors from a $t$ distribution with 3 degrees of freedom.
  • Skewed errors: exponential errors with their mean subtracted.
Scenario Coverage of textbook interval Coverage of HC3 interval Actual SD of $b_1$ Average reported SE
All assumptions hold 0.951 0.955 0.652 0.644
Variance grows with $x$ 0.921 0.937 0.821 0.733
Errors correlated in time 0.497 0.508 1.509 0.497
Heavy tails ($t_3$) 0.950 0.960 1.118 1.040
Skewed errors 0.954 0.963 0.651 0.632
Share of 10,000 simulated 95% intervals for the slope that contain the true slope, for each failure, with n = 30. Correlated errors halve the coverage; growing variance lowers it a little, and the HC3 interval recovers part of the loss; non-normal errors leave it close to 95%.
Share of 10,000 simulated 95% intervals for the slope that contain the true slope, for each failure, with n = 30. Correlated errors halve the coverage; growing variance lowers it a little, and the HC3 interval recovers part of the loss; non-normal errors leave it close to 95%.

In every scenario the average estimated slope is within 0.013 of the true value 2, so least squares remains unbiased in all of them. What fails is the reported uncertainty.

  • Correlated errors are the most damaging. The slope actually varies with a standard deviation of 1.509 across datasets, but its reported standard error averages 0.497, three times too small, and the nominal 95% interval contains the truth only half the time. HC3 does not help, because it corrects for unequal variance, not dependence. Worked problem 3 computes the factor of three exactly from the error correlations.
  • Unequal variance costs a few points of coverage, 0.921 instead of 0.95, and the HC3 interval brings it to 0.937.
  • Non-normal errors barely matter for the slope's interval at $n = 30$: coverage is 0.950 for heavy tails and 0.954 for skewed errors. The heavy tails make the slope less precise, an actual standard deviation of 1.118 against 0.652 with normal errors, but the reported standard error tracks that loss.

These are results for one sample size and particular strengths of each failure, observations of this experiment rather than general laws. Stronger violations would do more damage, but the ordering matches the ordering of Gelman et al. (2020). The simulation is seeded and can be rerun from tools/experiments/data-science/linear-regression-assumptions.py.

A routine for checking

  1. Think about validity and representativeness first. Establish what population the data describe, how they were collected, and whether observations are grouped in time, space or by subject.
  2. Plot residuals against fitted values. Look for curves (linearity) and funnels (variance).
  3. If the data have an order or a grouping, plot residuals by it. Look for runs and clusters (independence).
  4. Look for outliers and high-leverage points, using studentized residuals and leverages, and refit without them to see what changes.
  5. Make a Q-Q plot if individual predictions matter, for prediction intervals.

When an assumption fails, change what the failure calls for. A wrong form calls for a different model; dependence calls for a model of the dependence; unequal variance calls for robust standard errors, weighting or a transformation; and non-normality, if it matters at all, calls for a transformation or for intervals that do not assume normality, such as those from the bootstrap.

Worked problems

The problems extend the article on its own data. Every number is recomputed, with assertions, in the review-pass block of tools/experiments/data-science/linear-regression-assumptions.py.

Problem 1 (the average leverage, and a leverage of exactly 1). Show that the leverages of a simple regression sum to 2, and compute the leverages in Anscombe's fourth set exactly.

Solution. Summing the formula for $h_i$ over all observations gives

$$\sum_{i=1}^{n} h_i = n \cdot \frac{1}{n} + \frac{\sum_i (x_i - \bar{x})^2}{S_{xx}} = 1 + 1 = 2,$$

so the average is $2/n$, which is 0.0045 for the 442 patients. In Anscombe's fourth set, ten inputs equal 8 and one equals 19, so $\bar{x} = 99/11 = 9$ and $S_{xx} = 10 \times 1^2 + 10^2 = 110$. The point at 19 has $h = 1/11 + 100/110 = 1$ exactly, and each of the other ten has $1/11 + 1/110 = 1/10$. The leverages sum to $1 + 10 \times 1/10 = 2$, as they must. A leverage of 1 forces the residual to 0 (Proposition 2 of Leverage, Influence and Residual Diagnostics): the line passes through that point whatever its output. The ten points at $x = 8$ fix only the height of the line at 8, so the eleventh point alone sets the slope. A plot of the residuals shows nothing unusual there, which is why the leverage must be computed as well.

Problem 2 (the robust standard error written out). For one input, write the HC3 standard error of the slope as a sum over patients, check it against 0.6181, and explain why it is smaller than the classical 0.6738 for the diabetes data.

Solution. The slope error is $b_1 - \beta_1 = \sum_i w_i\varepsilon_i$ with $w_i = (x_i - \bar{x})/S_{xx}$. For independent errors with variances $\sigma_i^2$, $\mathrm{Var}(b_1) = \sum_i w_i^2\sigma_i^2$. White's estimator replaces each $\sigma_i^2$ by $e_i^2$, and HC3 by $e_i^2/(1 - h_i)^2$, which inflates the residuals of high-leverage points, since they are pulled toward the line. So

$$\mathrm{SE}_{\text{HC3}}(b_1) = \sqrt{\sum_i w_i^2\,\frac{e_i^2}{(1 - h_i)^2}} = 0.6181,$$

the matrix value. White's version without the factor gives 0.6128. The classical formula assumes a common $\sigma^2$, so it amounts to giving every patient's squared residual the same weight. The robust sum weights each squared residual by $w_i^2$, which is largest for patients far from the mean BMI. Those patients have smaller residuals: the 143 patients more than one standard deviation from the mean BMI have a residual standard deviation of 59.3, against 64.0 for the others. The robust standard error is smaller because the patients who determine the slope are the less noisy ones.

Problem 3 (where the factor of three comes from). In the simulation, correlated errors give a slope that varies with standard deviation 1.509 while the reported standard error averages 0.497. Derive both effects exactly for evenly spaced inputs $x_i = i/31$, $i = 1, \dots, 30$, and errors with correlation $0.8^{|i-j|}$ and variance 1.

Solution. Two things go wrong, and both can be computed from the error covariance matrix $\Sigma$, with entries $0.8^{|i-j|}$. First, the slope varies more than the formula says. With $b_1 - \beta_1 = \mathbf{w}^{\mathsf{T}}\boldsymbol\varepsilon$,

$$\mathrm{Var}(b_1) = \mathbf{w}^{\mathsf{T}}\Sigma\,\mathbf{w}.$$

For these inputs that is 5.35 times the independent-error value $1/S_{xx}$. The true standard deviation is 1.512, against 0.654 if the errors were independent. Neighboring errors share sign, so a run of positive errors at one end tilts the whole line. Second, the residuals understate the error variance. The residual vector is $(I - H)\boldsymbol\varepsilon$, where $H$ is the hat matrix, so $E[\mathrm{RSS}] = E[\boldsymbol\varepsilon^{\mathsf{T}}(I - H)\boldsymbol\varepsilon] = \operatorname{tr}\bigl((I - H)\Sigma\bigr)$, and

$$E[s^2] = \frac{\operatorname{tr}\bigl((I - H)\Sigma\bigr)}{n - 2} = 0.607.$$

Correlated errors drift smoothly, and the fitted line absorbs part of the drift, so $s^2$ averages only 0.607 instead of 1. A typical reported standard error is therefore $\sqrt{0.607/S_{xx}} = 0.509$, and the ratio $1.512/0.509 = 2.97$ is the factor of three. The simulation drew its inputs at random rather than evenly and found 1.509 and 0.497, close to these exact values. More data do not cure the problem, and the factor of three is exact in the limit. Write $\Sigma_{ij} = \phi^{|i-j|}$ with $\phi = 0.8$. Then $\mathbf{w}^{\mathsf{T}}\Sigma\mathbf{w} = \sum_k \phi^{|k|}\sum_i w_iw_{i+k}$. For evenly spaced inputs, $\sum_i w_iw_{i+k}/\sum_i w_i^2 \to 1$ for each fixed $k$, because with $w_i$ proportional to $i - (n + 1)/2$ the two sums differ by terms of order $kn^2$, while $\sum_i w_i^2$ grows like $n^3$. By the Cauchy–Schwarz inequality each ratio is at most 1 in size, and $\sum_k \phi^{|k|}$ converges, so dominated convergence gives

$$\frac{\mathrm{Var}(b_1)}{1/S_{xx}} \to \sum_{k=-\infty}^{\infty}\phi^{|k|} = \frac{1 + \phi}{1 - \phi} = 9,$$

the long-run variance of the AR(1) errors (Theorem 1 of Resampling Dependent and Clustered Data). Meanwhile $E[s^2] = (n - \operatorname{tr}(H\Sigma))/(n - 2)$, because $\operatorname{tr}\Sigma = n$. Here $0 \le \operatorname{tr}(H\Sigma) \le \operatorname{tr}(H)\,\lambda_{\max}(\Sigma) \le 2 \times 9$, since $H$ has trace 2 and the largest eigenvalue of $\Sigma$ is at most its largest row sum, which is below 9. So $E[s^2] \to 1$. The true standard deviation therefore approaches $\sqrt{9} = 3$ times the typical reported one. Repeating the exact calculation for 100 and 300 evenly spaced points shows the approach: the variance ratio is 7.81 and 8.60, $E[s^2]$ is 0.853 and 0.948, and the factor is 3.03 and 3.01. At $n = 30$ both quantities fall well short of their limits, 5.35 against 9 and 0.607 against 1, by similar factors, so their ratio already gives 2.97. Dependence must be modeled rather than waited out. Generalized least squares with the right $\Sigma$ is the best linear unbiased estimator (Aitken's theorem, Theorem 4 of The Gauss–Markov Theorem).

Open questions

  • How does the damage from correlated errors scale? A grid over sample sizes (30, 100, 300) and correlations (0.2 to 0.9), 30 seeds each, comparing the classical interval with an autocorrelation-consistent (Newey–West) interval and with regression with AR(1) errors, would show how much of the lost coverage each remedy recovers.
  • Is the order of the diabetes file meaningful? The lag-1 correlation of the residuals in file order, 0.075, is 1.6 times its null standard error $1/\sqrt{442} = 0.048$: suggestive, not conclusive. A permutation test of the lag-1 correlation, and the enrollment order from the study's own records, would settle whether neighbors in the file share anything.
  • How much of the narrow lower third does the floor at 25 explain? Simulating outcomes from the fitted line with a constant error standard deviation of 62.5, removing or censoring values below 25, and comparing the residual spread by thirds with the observed 49.6, 67.9 and 68.4 would separate the floor's effect from genuine heteroscedasticity.

Where it leads

The assumptions here were stated for one input, but every one of them carries over unchanged to many inputs. Multiple Linear Regression adds inputs, and with them a new way for the model to fail, collinearity, along with polynomial terms that repair a wrong form at the risk of overfitting. The Statistics collection treats the diagnostics in depth: Leverage, Influence and Residual Diagnostics derives deletion formulas and Cook's distance, and The Normal Linear Model measures how much its intervals depend on normality.

In Python

None of these diagnostics needs a specialized library. The residuals come from any fitted model, the leverages from the formula above, and SciPy's probplot computes the points of a Q-Q plot. (Checked against scikit-learn 1.5.2 and SciPy 1.17.1, which produced the numbers here, November 2026.)

import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
from sklearn.datasets import load_diabetes
from sklearn.linear_model import LinearRegression

data = load_diabetes(scaled=False)
x, y = data.data[:, 2], data.target
model = LinearRegression().fit(x.reshape(-1, 1), y)
fitted = model.predict(x.reshape(-1, 1))
resid = y - fitted

n = len(y)
lev = 1 / n + (x - x.mean()) ** 2 / ((x - x.mean()) ** 2).sum()
sigma = np.sqrt((resid ** 2).sum() / (n - 2))
student = resid / (sigma * np.sqrt(1 - lev))
print(lev.max(), (np.abs(student) > 3).sum())   # 0.0314, 0

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(9, 3.5))
ax1.scatter(fitted, resid, s=8)
ax1.axhline(0, color="gray")
ax1.set_xlabel("fitted value")
ax1.set_ylabel("residual")
stats.probplot(resid, dist="norm", plot=ax2)   # normal Q-Q plot
plt.show()

The figures and numbers in this article are computed by tools/experiments/data-science/linear-regression-assumptions.py in the site's repository.

References

  • Anscombe, F. J. (1973). Graphs in statistical analysis. The American Statistician, 27(1), 17–21. record · 4 pages
  • Efron, B., Hastie, T., Johnstone, I., and Tibshirani, R. (2004). Least angle regression. The Annals of Statistics, 32(2), 407–499. record · 21 pages
  • Gelman, A., Hill, J., and Vehtari, A. (2020). Regression and Other Stories. Cambridge University Press. record · 7 pages
  • James, G., Witten, D., Hastie, T., and Tibshirani, R. (2021). An Introduction to Statistical Learning with Applications in R (2nd ed.). Springer. record · 39 pages
  • MacKinnon, J. G., and White, H. (1985). Some heteroskedasticity-consistent covariance matrix estimators with improved finite sample properties. Journal of Econometrics, 29(3), 305–325. record · 2 pages
  • White, H. (1980). A heteroskedasticity-consistent covariance matrix estimator and a direct test for heteroskedasticity. Econometrica, 48(4), 817–838. record · 3 pages

Reviewed: verified, 23 Nov 2026 · citations checked, 23 Nov 2026 · editorial review, 23 Nov 2026 · 8 revisions