By the end of this lesson, you should be able to
- Interpret slope and intercept in a simple linear regression.
- Explain why ordinary least squares minimizes squared residuals.
- Distinguish a descriptive regression fit from a causal claim.
Suppose you want to know whether a person’s hours of practice are related to how well they perform some task. You collect paired measurements and plot them.
A straight line looks plausible. Now what?
We need to decide which straight line best summarizes the relationship—and precisely what we mean by “best.”
The linear model
The familiar simple linear regression equation is
Here is the intercept, the predicted value when . The slope is the predicted change in associated with a one-unit increase in .
If the fitted line is , moving from to changes the predicted from 24 to 27.
That does not prove that changing by one unit will cause to increase by three. Regression can describe observational associations without identifying causal effects.
Also, interpreting the intercept at may be silly if the observed data only include values between 100 and 200.
What counts as a good line?
A residual is the difference between what we observed and what the line predicted:
We could try to minimize the sum of residuals, but positive and negative residuals can cancel. Instead, ordinary least squares chooses the line minimizing the sum of their squares:
For data in which the values are not all identical, the least-squares slope has the convenient formula
You needn’t calculate these by hand fifty times to understand the result. Instead, understand what the optimization rewards and penalizes.
Squaring deviations makes large errors particularly expensive. That can be a good property—but it also gives extreme observations considerable influence.
A fitted line isn’t a law of nature
Fitting a line requires relatively few mathematical assumptions. Inference about the slope, however, requires more care: how were observations collected, could outcomes be dependent, does variability change across predictor values, and is a linear mean function appropriate?
For descriptive prediction, we still need to check that the line doesn’t systematically miss an obvious curve. We should also be cautious about extrapolating beyond the range where observations were collected.
What about correlation?
For simple regression with an intercept, the estimated slope and Pearson correlation have the same sign. They are related by
provided both sample standard deviations are positive.
But slope and correlation are not interchangeable. Correlation has no units; slope has units of per unit of . A relationship can be strongly linear while its slope is numerically very small, merely because the variables use different scales.
Exercise
- For , find the fitted line.
- Why does ordinary least squares square residuals?
- Is the intercept always scientifically meaningful?
Worked responses
-
Every point falls on , so the sum of squared residuals is zero.
-
Squaring avoids positive and negative cancellation and strongly penalizes larger errors. It also yields a mathematically convenient optimization problem.
-
No. The value might not be possible or might lie far outside the observed predictor range.
Read further
OpenStax: Linear Regression and Correlation introduces the same core ideas and applied questions.
Derive the normal equations
Minimize . Setting its partial derivatives to zero gives and . The first implies . Substitution into the second gives
provided . The quadratic objective is minimized by these coefficients; if all predictors coincide, an intercept and slope cannot be separately identified.
For pairs and responses , centered predictor squares sum to 10 and cross-products to 6. The fitted line is , passes through , and has residuals . Their sum is zero and residual sum of squares is 2.4. The zero-sum property follows from the fitted intercept, not from a belief that individual errors cancel exactly in nature.
Least-squares fitting does not itself require normal errors. Normality, independence, and variance conditions enter particular inferential claims and prediction procedures. A deterministic algorithm can always return a line when the design is identified, even for data that make a straight-line scientific model inappropriate.
Further problems
- Fit a least-squares line to .
- What changes if 10 is added to every response? If the predictor is converted from metres to centimetres?
- Why does the fitted line with an intercept pass through the observed mean pair?
Worked further solutions
- , with zero residual sum of squares.
- The intercept increases by 10 and slope stays fixed. Multiplying predictor values by 100 divides the numerical slope by 100, preserving fitted values.
- The normal equation gives , so .
Keep your place
Mark this lesson complete after you've read it, attempted its exercises, and explained its central idea in your own words.
Progress is not saved unless you choose to mark the lesson complete.
Saved only in this browser's local storage. No required account, server transmission, or analytics. You can reset your saved progress on the course page. Clearing browser data also clears the record.