Simple Linear Regression

Statistics
Introduced by
Adrien-Marie Legendre (least squares, 1805); Francis Galton (regression concept, 1886)
Year
1805
Type
Parametric bivariate regression

What does it do?

Simple linear regression is the foundational parametric method for modelling a straight-line relationship between one continuous predictor and one continuous outcome, estimating the slope and intercept by ordinary least squares (OLS).

The least squares principle is usually credited to Adrien-Marie Legendre's 1805 publication, although Carl Friedrich Gauss later claimed earlier use of the method. Francis Galton introduced the term 'regression' in 1886, in a study of hereditary stature that gave the family of methods its name.

The intuition behind the method

Imagine plotting pairs of measurements — say, hours of study and exam score — on a scatter plot. Simple linear regression finds the single straight line that passes as close as possible to all the data points at once, where 'close' means the sum of the squared vertical gaps between each point and the line is minimised. The slope of that line tells you how much the outcome tends to rise (or fall) for each one-unit increase in the predictor, and the intercept tells you the predicted outcome when the predictor equals zero. Because the line summarises an average tendency, any individual point can fall above or below it — those vertical gaps are called residuals, and the model's quality depends heavily on how small and well-behaved they are.

History

The least squares criterion was published by Adrien-Marie Legendre in 1805, in an appendix to a work on the determination of comet orbits. Carl Friedrich Gauss later claimed to have used the method before that publication. Francis Galton introduced the term 'regression' in 1886, in a paper on hereditary stature that described a tendency he called regression towards mediocrity. Galton's collaborator Karl Pearson later formalised the correlation coefficient, which is closely linked to R² in simple regression. The Gauss-Markov theorem, which establishes the optimality of OLS among linear unbiased estimators, is a separate result that followed the original least squares proposal.

When to use it

Use simple linear regression when the question involves one continuous predictor and one continuous outcome, and the aim is to describe the direction and size of a linear association or to predict outcome values from the predictor. Before fitting, check the scatterplot for a roughly straight-line pattern. After fitting, check the residuals for constant spread across X and for approximate normality. The Gauss-Markov conditions (linearity, independence, constant error variance, zero-mean errors) are what justify OLS as the best linear unbiased estimator; normality is additionally needed for exact t-based inference, and it matters most in small samples. Do not use it when the outcome is binary or a count, when the relationship is clearly curved, when observations are clustered or repeated over time (so independence fails), or when other variables must be adjusted for; in those cases consider logistic, polynomial or multiple regression instead. When the predictor is a two-level categorical variable coded 0/1, the slope equals the difference between the two group means and the slope t-test coincides with the pooled-variance (Student) independent t-test; Welch's test, which allows unequal variances, is not equivalent to it.

Limitations and considerations

  • Only one predictor is included, so any variable that affects both X and Y is absorbed into the slope; the estimate is not adjusted for confounders.
  • Squared residuals give extreme values large weight, so a few high-leverage or outlying points can shift the estimated slope substantially.
  • If the true relationship is curved, the fitted line describes an average of a nonlinear trend and the model is misspecified, which biases predictions.
  • Under heteroscedasticity the point estimates remain unbiased, but the usual standard errors and t-tests are invalid, so the reported intervals and p-values are unreliable.
  • Predictions beyond the observed range of X assume the straight-line form continues outside the data, which the data cannot verify.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • The slope and intercept have direct interpretations: the slope is the expected change in Y for each one-unit increase in X, and the intercept is the expected Y at X = 0, which is meaningful only when X = 0 is within or near the observed range.
  • The OLS estimates have closed forms in S_XY and S_XX, so they can be computed directly without iterative optimisation.
  • Under the Gauss-Markov conditions the estimators are BLUE, meaning they have the smallest variance among linear unbiased estimators; this result does not depend on normality.
  • When errors are normal, the slope t-statistic follows a t-distribution with n − 2 degrees of freedom, which gives exact confidence intervals and tests in small samples.
  • It is the base case for multiple regression, so the same logic for coefficients, residuals and fit carries over directly to models with more predictors.

Applications

  • Estimating the effect of a single explanatory variable on an outcome in biomedical, social, and economic research.
  • Calibration studies that establish a linear relationship between an instrument's readings and known reference values.
  • Simple demand or sales forecasting when a single leading indicator (e.g., advertising spend) drives the outcome.
  • Educational research quantifying how study time, prior achievement, or resource availability predicts test scores.
  • Quality control and process improvement, where a process input is regressed on a product characteristic to identify the operating point.

How it works

How it works

1

The model specifies that each observed outcome Y is the sum of a true linear signal (β₀ + β₁X) and a random error term ε. The error terms are assumed to be independent, identically distributed, and normally distributed with mean zero and constant variance σ². The intercept β₀ is the expected value of Y when X equals zero; the slope β₁ is the expected change in Y for a one-unit increase in X.

Formula
Y_i = \beta_0 + \beta_1 X_i + \varepsilon_i, \quad \varepsilon_i \overset{\text{iid}}{\sim} \mathcal{N}(0,\,\sigma^2)
2

The least squares criterion (Legendre, 1805) minimises the sum of squared residuals with respect to both parameters. The closed-form solutions are: the slope estimate equals the sample covariance of X and Y divided by the sample variance of X (S_XY / S_XX), and the intercept places the fitted line through the point of sample means (X̄, Ȳ). Under the Gauss-Markov conditions (random sampling of observations, linearity, independence, zero-mean errors, constant error variance, and non-zero variance of X, so that the design matrix has full rank), these estimators are the best linear unbiased estimators (BLUE): no other linear unbiased estimator has smaller variance. This result does not require normally distributed errors; normality is needed for the exact t-distribution used in inference.

Formula
\hat{\beta}_1 = \dfrac{\sum_{i=1}^n (X_i - \bar{X})(Y_i - \bar{Y})}{\sum_{i=1}^n (X_i - \bar{X})^2} = \dfrac{S_{XY}}{S_{XX}}, \qquad \hat{\beta}_0 = \bar{Y} - \hat{\beta}_1\,\bar{X}
3

Once the estimates are obtained, the fitted value Ŷᵢ is the model's prediction for observation i, and the residual eᵢ is the difference between the actual and predicted value. Residuals should be inspected in diagnostic plots: a residual-versus-fitted plot checks for nonlinearity and heteroscedasticity, and a normal Q-Q plot checks the normality assumption.

Formula
\hat{Y}_i = \hat{\beta}_0 + \hat{\beta}_1 X_i, \qquad e_i = Y_i - \hat{Y}_i
4

The hypothesis H₀: β₁ = 0 (no linear relationship) is tested with a t-statistic equal to the slope estimate divided by its standard error. The standard error depends on the mean square error (MSE) and the spread of X values. The statistic follows a t-distribution with n − 2 degrees of freedom. An equivalent F-test appears in the analysis-of-variance table for the regression.

Formula
t = \dfrac{\hat{\beta}_1}{\mathrm{SE}(\hat{\beta}_1)}, \quad \mathrm{SE}(\hat{\beta}_1) = \sqrt{\dfrac{MSE}{S_{XX}}}, \quad t \sim t_{n-2}
5

R² (the coefficient of determination) measures the proportion of total variability in Y explained by the linear relationship with X. It ranges from 0 (no fit) to 1 (perfect fit) and equals the square of the Pearson correlation coefficient in simple regression. The adjusted form is not needed here because there is only one predictor, but the residual standard error s = √MSE provides a scale-sensitive measure of fit.

Formula
R^2 = 1 - \dfrac{SS_{\text{Res}}}{SS_{\text{Tot}}} = \dfrac{SS_{\text{Reg}}}{SS_{\text{Tot}}}

Common pitfalls

  • Fitting the line before inspecting the scatterplot: a curved relationship produces a slope that describes the data poorly.
  • Interpreting R² as a measure of causal effect; a high R² reflects association, not causation.
  • Relying on the slope's p-value alone without residual diagnostics; residual plots are the direct check on linearity, constant variance and normality, and the p-value does not test them.
  • Treating the regression of Y on X as identical to the regression of X on Y; the two lines coincide only when R² = 1.
  • Confusing statistical significance of the slope with practical importance; report the slope estimate and its confidence interval, not only p.

Frequently asked questions

What is the difference between correlation and simple linear regression?

Pearson correlation measures the strength and direction of the linear association between two variables without distinguishing predictor from outcome; it is symmetric. Simple linear regression assigns one variable as the predictor and the other as the outcome, estimates a slope and intercept, and produces predictions. In simple regression, R² equals the square of the Pearson correlation coefficient, linking the two, but regression provides additional inferential machinery — confidence intervals for the slope, prediction intervals for new observations — that correlation alone does not.

How do I check whether the linear model is appropriate?

Start with a scatterplot of Y versus X before fitting; a systematic curve suggests nonlinearity. After fitting, examine the residual-versus-fitted plot — a random horizontal scatter indicates linearity and homoscedasticity; a funnel shape suggests heteroscedasticity; a curve suggests a nonlinear relationship. A normal Q-Q plot of residuals checks the normality assumption. For individual influential points, inspect influence diagnostics for each observation.

Does a high R² mean the model is good?

Not necessarily. R² measures only how much variance is explained, not whether the model is correctly specified. A high R² can coexist with systematic patterns in the residuals (indicating model misspecification), while a low R² can be perfectly acceptable in noisy fields such as psychology or economics where human behaviour is inherently variable. Always inspect residual diagnostics and report the slope estimate with its confidence interval, not R² alone.

What should I do if my data violate the homoscedasticity assumption?

First confirm heteroscedasticity visually (funnel pattern in residuals vs. fitted plot) or with a formal heteroscedasticity test. Common remedies include applying a variance-stabilising transformation to Y (e.g., log or square root), using weighted least squares with weights proportional to the inverse of the error variance, or computing heteroscedasticity-consistent standard errors, which leave the point estimates unchanged.

Related methods

Sources

  1. Legendre, A. M. (1805). Nouvelles méthodes pour la détermination des orbites des comètes. Firmin Didot, Paris. [Appendix: Sur la méthode des moindres quarrés, pp. 72–80]

    Open publication reference
  2. Galton, F. (1886). Regression towards mediocrity in hereditary stature. Journal of the Anthropological Institute of Great Britain and Ireland, 15, 246–263.

    Open DOI reference
  3. Montgomery, D. C., Peck, E. A., & Vining, G. G. (2021). Introduction to Linear Regression Analysis (6th ed.). Wiley.

    ISBN: 978-1119578727