Explainer
Linear regression explained: fitting a line and reading the results
Linear regression fits a line, or more generally a weighted sum of explanatory variables, to data by choosing the values that minimise the squared gaps between the observations and the model; NIST calls it by far the most widely used modelling method.[1][2] Its r-squared shows how much of the variation in the outcome the model accounts for, but a high value does not prove a good fit or a cause.[3][4] Outliers and extrapolation beyond the data are its best-known weak spots.[5][6]
Linear regression is the standard way to describe how one quantity changes with another, and to predict one from the other. The US National Institute of Standards and Technology (NIST) calls linear least squares regression by far the most widely used modelling method, and what most people mean when they say they used “regression”.[1] This page explains how the line is fitted, how to read the main outputs, and where the method misleads.
Fitting the line
A linear regression model multiplies each explanatory variable by an unknown parameter and adds the terms up, with at most one extra parameter, the intercept, that has no variable attached.[7] With one explanatory variable that is a straight line: an intercept plus a slope times the variable.[2]
The parameters are estimated by least squares. The method picks the values that minimise the sum of the squared differences between the observed responses and the model.[2] Squaring gives extra weight to large misses, just as it does in the variance: a miss of 10 adds 100 to the sum, while a miss of 2 adds only 4.[8] NIST describes least squares as very sensitive to unusual data points.[5]
Plot each house’s floor area along the bottom and its price up the side, and you get a cloud of dots. Linear regression draws the single straight line that runs through the middle of the cloud, chosen so the vertical gaps between the dots and the line are as small as possible overall. The slope of that line is the estimated change in price for each extra square metre.[2]
NIST notes that many processes in science and engineering are well described by linear models, either because they are linear or because over short ranges almost any process can be approximated by a line. It adds that the method makes very efficient use of data and can give good results with relatively small data sets.[9]
Reading r-squared
The most quoted output after the slope is r-squared, the coefficient of determination. In simple regression, a value of 1 means all the data points fall on the line, and a value of 0 means the fitted line is flat and the predictor accounts for none of the variation in the outcome.[10] In between, Penn State’s regression course reads r-squared times 100 as the percent of the variation in the outcome that is reduced by taking the predictor into account. It warns that saying the variation is “explained by” the predictor can be misread as causation.[3]
What counts as a high value depends on the field. The same course notes that social scientists often struggle to get r-squared much above 25% or 30%, while engineers studying more exact systems might find 30% unacceptable.[11]
Where regression misleads
NIST lists three main weaknesses: linear models are limited in the shapes they can take over long ranges, they may extrapolate poorly, and they are sensitive to outliers. One or two unusual points can sometimes seriously skew the results.[5] NIST also warns that extrapolating beyond the range of the data is potentially dangerous whatever the model type.[6]
Penn State’s course lists several cautions about r-squared. It measures only linear association, so it can be zero even when a perfect curved relationship exists. A large value does not mean the line fits well, and one or a few data points can greatly change it. Above all, association does not imply causation.[4] Most data used in regression come from observational studies rather than experiments, so causal conclusions should not be overstated.[12] See correlation vs causation and natural experiments for how researchers try to get closer to causes.
NIST notes that the error term in regression models is often assumed to be normally distributed with fixed location and scale, which underpins the usual intervals and tests.[13] Correlations based on group averages or rates, known as ecological correlations, tend to overstate the strength of an association compared with individual-level data.[14] A related trap, where a trend reverses once data are split into groups, is covered in Simpson’s paradox.[15]
In the statistics course, read sampling bias first, then this page, then the law of large numbers.
Read next
Natural experiments: how researchers find causes without a trial
How natural experiments use chance events and policy changes to study cause and effect, the classic examples behind the 2021 economics Nobel, and their limits.
Questions readers ask
What does "least squares" mean?
It is the rule used to pick the line. The model's parameters are set to the values that minimise the sum of the squared differences between the observed responses and the model's predictions.[2]
What does r-squared tell you?
In simple linear regression, r-squared times 100 is the percent of the variation in the outcome that is reduced by taking the predictor into account. A value of 1 means every point lies on the line; 0 means the line is flat and the predictor accounts for none of the variation.[3][10]
Is a high r-squared always good?
No. A large r-squared does not mean the line fits the data well, one or a few points can greatly affect it, and it says nothing about cause and effect.[4]
Why is it called "linear" if the line can curve?
The model is linear in its unknown parameters, each multiplied by an explanatory variable and summed. The fitted function itself need not be a straight line.[7]
Can I use a regression line to predict far outside my data?
It is risky. NIST warns that linear models may not extrapolate well beyond the region where data were collected, and that extrapolation is potentially dangerous whatever the model.[6]
Sources
· 15 claims from 4 publishers
Each numbered claim is a statement we checked against the sources listed with it. Tap a number in the text to see its sources in place.
- [1]
NIST calls linear least squares regression by far the most widely used modelling method, and what most people mean when they say they used "regression", "linear regression" or "least squares". confirmedas of 2026-11-21
- NIST/SEMATECH e-Handbook of Statistical Methods: Linear Least Squares Regression · National Institute of Standards and Technology · Primary source · Modeling Workhorse (retrieved 2026-11-21)
- [2]
Least squares estimates a model's parameters by choosing the values that minimise the sum of the squared deviations between the observed responses and the model; for a straight line this means choosing the intercept and slope that minimise that sum. confirmedas of 2026-11-21
- NIST/SEMATECH e-Handbook of Statistical Methods: Least Squares · National Institute of Standards and Technology · Primary source · General LS Criterion (retrieved 2026-11-21)
- NIST/SEMATECH e-Handbook of Statistical Methods: Least Squares · National Institute of Standards and Technology · Primary source · LS for Straight Line (retrieved 2026-11-21)
- [3]
Penn State's regression course interprets r-squared times 100 as the percent of the variation in the response that is reduced by taking the predictor into account, and warns that saying it is "explained by" the predictor can be misread as causation. reportedas of 2026-11-21
- STAT 462, 2.5: The Coefficient of Determination, r-squared · Penn State Eberly College of Science · Secondary source · 2.5 (retrieved 2026-11-21)
- STAT 462, 2.5: The Coefficient of Determination, r-squared · Penn State Eberly College of Science · Secondary source · 2.5 (retrieved 2026-11-21)
- [4]
Penn State's course cautions that r-squared measures only linear association (it can be 0 even when a perfect curved relationship exists), that a large value does not mean the line fits well, that one or a few data points can greatly affect it, and that association does not imply causation. reportedas of 2026-11-21
- STAT 462, 2.8: R-squared Cautions · Penn State Eberly College of Science · Secondary source · Caution 1 (retrieved 2026-11-21)
- STAT 462, 2.8: R-squared Cautions · Penn State Eberly College of Science · Secondary source · Caution 2 (retrieved 2026-11-21)
- STAT 462, 2.8: R-squared Cautions · Penn State Eberly College of Science · Secondary source · Caution 3 (retrieved 2026-11-21)
- STAT 462, 2.8: R-squared Cautions · Penn State Eberly College of Science · Secondary source · Caution 4 (retrieved 2026-11-21)
- [5]
NIST lists the main disadvantages of linear least squares as limits on the shapes linear models can take over long ranges, possibly poor extrapolation, and sensitivity to outliers; one or two outliers can sometimes seriously skew the results. confirmedas of 2026-11-21
- NIST/SEMATECH e-Handbook of Statistical Methods: Linear Least Squares Regression · National Institute of Standards and Technology · Primary source · Disadvantages of Linear Least Squares (retrieved 2026-11-21)
- NIST/SEMATECH e-Handbook of Statistical Methods: Linear Least Squares Regression · National Institute of Standards and Technology · Primary source · Disadvantages of Linear Least Squares (retrieved 2026-11-21)
- [6]
NIST warns that linear models may not be effective for extrapolating beyond the region where data were collected, and that extrapolation is potentially dangerous whatever the model type. confirmedas of 2026-11-21
- NIST/SEMATECH e-Handbook of Statistical Methods: Linear Least Squares Regression · National Institute of Standards and Technology · Primary source · Disadvantages of Linear Least Squares (retrieved 2026-11-21)
- [7]
In a linear regression model, each explanatory variable is multiplied by an unknown parameter and the terms are summed; NIST notes the model is called "linear" because it is linear in the parameters, even though the fitted function need not be a straight line. confirmedas of 2026-11-21
- NIST/SEMATECH e-Handbook of Statistical Methods: Linear Least Squares Regression · National Institute of Standards and Technology · Primary source · Definition of a Linear Least Squares Model (retrieved 2026-11-21)
- NIST/SEMATECH e-Handbook of Statistical Methods: Linear Least Squares Regression · National Institute of Standards and Technology · Primary source · Definition of a Linear Least Squares Model (retrieved 2026-11-21)
- NIST/SEMATECH e-Handbook of Statistical Methods: Linear Least Squares Regression · National Institute of Standards and Technology · Primary source · Definition of a Linear Least Squares Model (retrieved 2026-11-21)
- [8]
The variance is roughly the average of the squared distances of the values from the mean; squaring gives extra weight to values far from the mean, so a point 2 units away adds 4 to the sum while a point 10 units away adds 100. confirmedas of 2026-11-21
- NIST/SEMATECH e-Handbook of Statistical Methods: Measures of Scale · National Institute of Standards and Technology · Primary source · Definitions of Variability (retrieved 2026-11-21)
- NIST/SEMATECH e-Handbook of Statistical Methods: Measures of Scale · National Institute of Standards and Technology · Primary source · Definitions of Variability (retrieved 2026-11-21)
- [9]
NIST says many processes are well described by linear models, either because they are inherently linear or because over short ranges any process can be well approximated by a linear model, and that linear least squares makes very efficient use of data, giving good results with relatively small data sets. confirmedas of 2026-11-21
- NIST/SEMATECH e-Handbook of Statistical Methods: Linear Least Squares Regression · National Institute of Standards and Technology · Primary source · Advantages of Linear Least Squares (retrieved 2026-11-21)
- NIST/SEMATECH e-Handbook of Statistical Methods: Linear Least Squares Regression · National Institute of Standards and Technology · Primary source · Advantages of Linear Least Squares (retrieved 2026-11-21)
- [10]
In simple linear regression, an r-squared of 1 means all data points fall on the fitted line, and an r-squared of 0 means the fitted line is horizontal and the predictor accounts for none of the variation in the response. reportedas of 2026-11-21
- STAT 462, 2.5: The Coefficient of Determination, r-squared · Penn State Eberly College of Science · Secondary source · 2.5 (retrieved 2026-11-21)
- STAT 462, 2.5: The Coefficient of Determination, r-squared · Penn State Eberly College of Science · Secondary source · 2.5 (retrieved 2026-11-21)
- [11]
Penn State's course notes that what counts as a large r-squared depends on the field; social scientists often find it hard to get values much above 25% or 30%, while engineers might find 30% unacceptable. reportedas of 2026-11-21
- STAT 462, 2.5: The Coefficient of Determination, r-squared · Penn State Eberly College of Science · Secondary source · 2.5 (retrieved 2026-11-21)
- STAT 462, 2.5: The Coefficient of Determination, r-squared · Penn State Eberly College of Science · Secondary source · 2.5 (retrieved 2026-11-21)
- STAT 462, 2.5: The Coefficient of Determination, r-squared · Penn State Eberly College of Science · Secondary source · 2.5 (retrieved 2026-11-21)
- [12]
Penn State's course notes that experiments, where the researcher controls the predictor values, usually allow causal conclusions, while observational studies do not, and that most data used in regression analyses come from observational studies. reportedas of 2026-11-21
- STAT 462, 2.8: R-squared Cautions · Penn State Eberly College of Science · Secondary source · Caution 4 (retrieved 2026-11-21)
- STAT 462, 2.8: R-squared Cautions · Penn State Eberly College of Science · Secondary source · Caution 4 (retrieved 2026-11-21)
- [13]
According to NIST, many classical statistical tests assume the data follow a normal distribution (an assumption that should be tested first), regression models often assume normally distributed errors, and the normal distribution is used to find significance levels in many hypothesis tests and confidence intervals. confirmedas of 2026-11-21
- NIST/SEMATECH e-Handbook of Statistical Methods: Normal Distribution · National Institute of Standards and Technology · Primary source · Comments (retrieved 2026-11-21)
- [14]
Correlations based on group rates or averages (ecological correlations) tend to overstate the strength of an association compared with individual-level data. reportedas of 2026-11-21
- STAT 462, 2.8: R-squared Cautions · Penn State Eberly College of Science · Secondary source · Caution 5 (retrieved 2026-11-21)
- [15]
Simpson's paradox is a statistical phenomenon in which an association between two variables in a population emerges, disappears or reverses when the population is divided into subpopulations. confirmedas of 2026-11-21
- Simpson's Paradox (Stanford Encyclopedia of Philosophy) · Stanford Encyclopedia of Philosophy · Primary source · preamble (retrieved 2026-11-21)
- Simpson's paradox in psychological science: a practical guide (Frontiers in Psychology) · Frontiers in Psychology (via PubMed Central) · Primary source · 2013-08-12 · abstract (retrieved 2026-11-21)
Revision history (1)
- Page created.
Created Nov 21, 2026. Last reviewed by an editor on Nov 22, 2026. Next scheduled review: Jul 21, 2027.
Cite this page
"Linear regression explained: fitting a line and reading the results." ContentLora, updated Nov 21, 2026. https://contentlora.com/explain/linear-regression-explained
Spotted an error? Suggest a correction or emailcorrections@contentlora.com.