You are reading the 2026 curriculum (exams up to November 2026). Sitting in February 2027 or later? Go to the 2027 Quantitative Methods guide.
The regression line: slope, intercept and least squares
Simple linear regression explains a dependent variable Y with one independent variable X: Y = b₀ + b₁X + ε. Least squares chooses the line that makes the sum of squared residuals as small as possible, giving b₁ = Cov(X, Y) ÷ Var(X) and b₀ = Ȳ − b₁X̄.
Before this: Statistical Measures of Asset Returns, Parametric and Non-Parametric Tests of Independence
On the exam
- Describe a simple linear regression model, how the least squares criterion is used to estimate regression coefficients, and the interpretation of these coefficients
Describe the simple linear regression model, how least squares estimates the coefficients, and interpret them. Expect to compute a slope from a covariance and a variance, then an intercept from the means. Wrong options divide by the variance of Y or swap X and Y.
How deeply to learn each part
- Know the idea
- Understand it in general. It frames other topics, but you will not calculate with it.
- Use it
- Understand it well enough to solve a question with it. Recognize when it applies.
- Memorize
- Learn it by heart. The exam will not give it to you.
You know this one. The full lesson is folded away. The takeaways, formulas and checkpoint below are your quick refresher, and the checkpoint is a fair test of whether you still do.
You tested strong here. The full lesson is folded away. The takeaways, formulas and checkpoint below are your quick refresher, and the checkpoint is a fair test of whether you still know it.
What is a simple linear regression?
A simple linear regression explains the variation in one variable using one other variable and a straight line. The variable you want to explain is the dependent variable , Y. The variable you use to explain it is the independent variable , X.
The regression coefficients are the intercept , , and the slope coefficient , . The error term , , is everything about that the line does not capture.
- Dependent variable, Y Memorize the variable you want to explain
- Also called explained variable, predicted variable
-
- Independent variable, X Memorize the variable doing the explaining
- Also called explanatory variable, predictor
-
- Regression coefficients Memorize estimated from the data
- Intercept, b₀ predicted Y when X = 0
- Slope, b₁ change in predicted Y per one-unit rise in X
-
- Error term, ε Use it what the line leaves unexplained
- Residual, e the sample estimate of ε: actual Y minus fitted Y
-
Throughout this module we use one small data set. Six retailers report their marketing spend as a percentage of sales (X) and their revenue growth in percent (Y).
| Retailer | A | B | C | D | E | F |
|---|---|---|---|---|---|---|
| Marketing spend, X (%) | 2 | 3 | 5 | 6 | 8 | 9 |
| Revenue growth, Y (%) | 4 | 5 | 9 | 8 | 12 | 13 |
How does least squares choose the line?
Any line gives a fitted value , , for each observation. The miss, , is the residual : actual minus fitted. It is the sample’s estimate of the error term. Square each residual and add them up to get the sum of squares error , SSE. The least squares line is the one with the smallest SSE.
Squaring does two jobs. Positive and negative misses cannot cancel, and a big miss counts far more than a small one. Calculus then gives a closed-form answer for the two coefficients.
The second formula says the fitted line always passes through the point of means, .
The covariance of X and Y is 9.7 and the variance of X is 7.5. The slope of the regression of Y on X is closest to:
9.7 ÷ 7.5 = 1.2933
Slope coefficient, b₁1.2933
- 9.7÷7.5=
- 9.7ENTER7.5÷
ENTER enter (on the HP, puts the number on the stack)
The means are X̄ = 5.5 and Ȳ = 8.5, and the regression slope is 1.2933. The intercept is closest to:
8.5 − 1.2933 × 5.5 = 1.3869
Intercept, b₀1.3869
- 8.5−(1.2933×5.5)=
- 8.5ENTER1.2933ENTER5.5×−
ENTER enter (on the HP, puts the number on the stack)
Try this 0 of 3
- Drag your line until its SSE is within 10% of the minimum (no snapping needed).
- Snap to least squares and read the sum of the residuals.
- In “Move the data”, drag one point until it misses the line by 3 or more.
Your line Ŷ = 2.00 + 1.00X has a sum of squared residuals of 12.00. The least-squares line Ŷ = 1.39 + 1.29X has the smallest possible, 2.77. Least squares is the line with the smallest total area of squared misses.
Drag either round handle on the line, or focus it and use the arrow keys.
- Retailer
- Your line
- Squared miss
Your squares cover 4.3 times the least-squares area. Drag a handle, or snap to least squares.
Show working
Means: X̄ = 5.50, Ȳ = 8.50 (n = 6).
Σ(X − X̄)(Y − Ȳ) = 15.75 + 8.75 − 0.25 − 0.25 + 8.75 + 15.75 = 48.50.
Σ(X − X̄)² = 12.25 + 6.25 + 0.25 + 0.25 + 6.25 + 12.25 = 37.50.
b₁ = 48.50 ÷ 37.50 = 1.2933 (the same as Cov(X, Y) ÷ Var(X) = 9.7000 ÷ 7.5000).
b₀ = Ȳ − b₁X̄ = 8.50 − 1.2933 × 5.50 = 1.3867.
Least-squares residuals Y − Ŷ: 0.03, −0.27, 1.15, −1.15, 0.27, −0.03 (they sum to zero). SSE = 2.7733.
Your line Ŷ = 2.00 + 1.00X: SSE = 0.00² + 0.00² + 2.00² + 0.00² + 2.00² + 2.00² = 12.00.
- 2NDDATA2NDCLR WORKclear old data
- 2ENTER↓4ENTER↓X01, Y01
- 3ENTER↓5ENTER↓X02, Y02
- 5ENTER↓9ENTER↓X03, Y03
- 6ENTER↓8ENTER↓X04, Y04
- 8ENTER↓12ENTER↓X05, Y05
- 9ENTER↓13ENTER↓X06, Y06
- 2NDSTATpress 2ND SET until LIN shows
- ↓↓↓↓↓↓↓↓a = 1.3867 (intercept)
- ↓b = 1.2933 (slope)
- ↓r = 0.9786
2ND second function (the shifted label above a key) · DATA data worksheet · CLR WORK clear the worksheet · ENTER enter (on the HP, puts the number on the stack) · STAT statistics worksheet
- fCLEAR Σ
- 4ENTER2Σ+Y first, then X
- display1
- 5ENTER3Σ+Y first, then X
- display2
- 9ENTER5Σ+Y first, then X
- display3
- 8ENTER6Σ+Y first, then X
- display4
- 12ENTER8Σ+Y first, then X
- display5
- 13ENTER9Σ+Y first, then X
- display6
- 0gŷ,rSTO7a = 1.3867 (intercept: ŷ at x = 0
- storeitinR7,sinceΣ+keepsnandthesumsinR1toR6)
- x≷yr = 0.9786
- 1gŷ,rRCL7−b = 1.2933 (slope: ŷ at x = 1 minus ŷ at x = 0)
f gold shift key · CLEAR Σ clear the statistics registers · ENTER enter (on the HP, puts the number on the stack) · Σ+ add a data point · g blue shift key · ŷ,r estimated y and correlation · STO store · x≷y swap the last two numbers · RCL recall a stored number
Display: b₀ 1.3867, b₁ 1.2933, r 0.9786
How is the slope related to the correlation?
Dividing the covariance by both standard deviations gives the correlation, . Dividing by the variance of X alone gives the slope. So the two are linked by the ratio of standard deviations.
For the six retailers , and , and . A positive correlation always means a positive slope, and the slope is in units of Y per unit of X, while has no units.
What are the residuals telling you?
Put the fitted line next to the data and each retailer has a residual.
| Retailer | X | Y | Fitted Ŷ | Residual e |
|---|---|---|---|---|
| A | 2 | 4 | 3.97 | 0.03 |
| B | 3 | 5 | 5.27 | −0.27 |
| C | 5 | 9 | 7.85 | 1.15 |
| D | 6 | 8 | 9.15 | −1.15 |
| E | 8 | 12 | 11.73 | 0.27 |
| F | 9 | 13 | 13.03 | −0.03 |
The residuals add up to zero, and their squares add up to SSE = 2.773. No other straight line through these points has a smaller sum of squares.
Exam tip On the exam you will usually be handed the covariance and variance, or the sums of squares. Slope first, then intercept. Check that the slope has the variance of X underneath it.
Go deeper Why squares and not absolute values?
Squares give a smooth function that calculus can minimize in one step, so the coefficients have simple formulas. They also punish large misses heavily, so one wild point pulls the line toward it. That is why a single outlier can tilt a least squares line, a point lesson 2 returns to.
Go deeper Beta is a regression slope
Regress a stock’s returns (Y) on the market’s returns (X) and the slope is the stock’s beta: Cov(stock, market) ÷ Var(market). The same slope formula you just used drives the capital asset pricing model in Portfolio Management. A time-series regression like this uses returns over time; a cross-sectional regression uses many companies at one date. The mechanics are identical.
Memorize this
MemorizeThe least squares line
| Item | What to know |
|---|---|
| Model | |
| Slope | |
| Intercept | |
| Residual | (actual − fitted) |
| Criterion | minimize (SSE) |
Memory hook Slope = covariance over the variance of X, the variable you stand on. Divide by both standard deviations and you get r, not the slope. The line always passes through (X̄, Ȳ), so the intercept just finishes the job.
Know it cold Least squares minimizes the sum of SQUARED residuals. Plain residuals always sum to zero, so they cannot be the criterion.
- Dependent variable, Y Memorize the variable you want to explain
- Also called explained variable, predicted variable
-
- Independent variable, X Memorize the variable doing the explaining
- Also called explanatory variable, predictor
-
- Regression coefficients Memorize estimated from the data
- Intercept, b₀ predicted Y when X = 0
- Slope, b₁ change in predicted Y per one-unit rise in X
-
- Error term, ε Use it what the line leaves unexplained
- Residual, e the sample estimate of ε: actual Y minus fitted Y
-
Quick example
Revenue growth (Y, %) on marketing spend (X, % of sales): Y = 1.39 + 1.29X + ε. A retailer spending 4% of sales is fitted at 1.39 + 1.29 × 4 = 6.55%; the gap to its actual growth is its residual.
- 1.29×4+1.39= 6.55
- 1.29ENTER4×1.39+ 6.55
ENTER enter (on the HP, puts the number on the stack)
Quick example
Cov(X, Y) = 0.0018 and Var(X) = 0.0024. Slope = 0.0018 ÷ 0.0024 = 0.75.
- 0.0018÷0.0024= 0.75
- 0.0018ENTER0.0024÷ 0.75
ENTER enter (on the HP, puts the number on the stack)
Quick example
Ȳ = 5, X̄ = 4 and slope 0.75. Intercept = 5 − 0.75 × 4 = 2.00.
- 5−(0.75×4)= 2
- 5ENTER0.75ENTER4×− 2
ENTER enter (on the HP, puts the number on the stack)
Quick example
Correlation 0.60, standard deviation of Y 5%, of X 4%. Slope = 0.60 × 5 ÷ 4 = 0.75.
- 0.6×5÷4= 0.75
- 0.6ENTER5×4÷ 0.75
ENTER enter (on the HP, puts the number on the stack)
How it is asked
-
Slope from covariance and variance
Cov(X, Y) = 0.0018, Var(X) = 0.0024, Var(Y) = 0.0030. Slope?
0.0018 ÷ 0.0024 = 0.75. Trap: dividing by Var(Y) gives 0.60; dividing by both standard deviations gives r = 0.67.
-
Intercept from the means
X̄ = 4, Ȳ = 5, slope 0.75. Intercept?
Ȳ − b₁X̄ = 5 − 3 = 2.00. Trap: swapping the roles gives 4 − 0.75 × 5 = 0.25.
-
What does least squares minimize?
Which quantity do the estimated coefficients minimize?
The sum of squared residuals (SSE). Not the sum of residuals (always zero) and not the sum of squares total (SST).
-
Interpret a coefficient
Ŷ = 3.0 + 0.5X. What is 3.0?
The predicted Y when X = 0: the intercept. The 0.5 is the change in Y per unit of X.
Exam traps
- Dividing the covariance by the variance of Y (or by both standard deviations, which gives the correlation r, not the slope).
- Swapping the dependent and independent variables: the regression of Y on X is not the regression of X on Y.
- Reading the intercept as meaningful when X = 0 lies far outside the observed data.
- Saying least squares minimizes the sum of the residuals. It minimizes the sum of the squared residuals.
Checkpoint
4 exam-style questions. About 90 seconds each.
1Cov(X, Y) = 0.0018, Var(X) = 0.0024 and Var(Y) = 0.0030. The slope of the regression of Y on X is closest to:
2With X̄ = 4% and Ȳ = 5%, and the slope from the previous question (0.75), the intercept is closest to:
3The least squares method chooses the regression coefficients that minimize the:
4In the fitted line Ŷ = 3.0 + 0.5X, the value 3.0 is best interpreted as the:
Key takeaways
- Y = b₀ + b₁X + ε; the residual is actual minus fitted.
- b₁ = Cov(X, Y) ÷ Var(X); b₀ = Ȳ − b₁X̄; the line passes through (X̄, Ȳ).
- Least squares minimizes the sum of squared residuals (SSE); the residuals sum to zero.
Quick example
Revenue growth (Y, %) on marketing spend (X, % of sales): Y = 1.39 + 1.29X + ε. A retailer spending 4% of sales is fitted at 1.39 + 1.29 × 4 = 6.55%; the gap to its actual growth is its residual.
- 1.29×4+1.39= 6.55
- 1.29ENTER4×1.39+ 6.55
ENTER enter (on the HP, puts the number on the stack)
Quick example
Cov(X, Y) = 0.0018 and Var(X) = 0.0024. Slope = 0.0018 ÷ 0.0024 = 0.75.
- 0.0018÷0.0024= 0.75
- 0.0018ENTER0.0024÷ 0.75
ENTER enter (on the HP, puts the number on the stack)
Quick example
Ȳ = 5, X̄ = 4 and slope 0.75. Intercept = 5 − 0.75 × 4 = 2.00.
- 5−(0.75×4)= 2
- 5ENTER0.75ENTER4×− 2
ENTER enter (on the HP, puts the number on the stack)
Quick example
Correlation 0.60, standard deviation of Y 5%, of X 4%. Slope = 0.60 × 5 ÷ 4 = 0.75.
- 0.6×5÷4= 0.75
- 0.6ENTER5×4÷ 0.75
ENTER enter (on the HP, puts the number on the stack)
Questions about this lesson?
Where this comes back
- Portfolio Risk and Return: Part II (CAPM and Performance Measures) Portfolio Construction
- Simple Linear Regression Quantitative Methods
Questions candidates ask
How do you calculate the slope of a regression line?
Divide the covariance of X and Y by the variance of X: b₁ = Cov(X, Y) ÷ Var(X). Equivalently, sum the cross-products of deviations from the means and divide by the sum of squared deviations of X. Then get the intercept from b₀ = Ȳ − b₁X̄.
What does the intercept mean in a regression?
It is the predicted value of Y when X is zero. It is only meaningful if X = 0 is plausible and near the data you observed. Otherwise it is just the number that positions the line so it passes through the point of means.
What is the least squares criterion?
Choose the intercept and slope that make the sum of squared residuals as small as possible. Squaring stops positive and negative misses from cancelling and penalizes big misses more. It gives one best line with simple formulas for the coefficients.
Spotted an error? Tell us and we will fix it.