Analyst Dojo
Lesson 1 of 6 6–9% of the exam

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̄.

8 min cram, 36 min full read. Based on the 2026 CFA® Program Level I curriculum, Quantitative Methods, Learning Module 10. This is the 2026 version of the lesson. Sitting in February 2027 or later? Read the updated 2027 version.

Tailor this to you: take the self-assessment

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.

Cram mode: the one-screen version of this lesson. Switch to Full for the explanations, worked examples and interactives.

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.

Simple linear regression model Memorize
Yi=b0+b1Xi+εiY_i = b_0 + b_1 X_i + \varepsilon_i

The regression coefficients are the intercept , b0b_0, and the slope coefficient , b1b_1. The error term , εi\varepsilon_i, is everything about YiY_i that the line does not capture.

The parts of a simple linear regression
Y = b₀ + b₁X + εone explained variable, one explaining variable
  • 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).

RetailerABCDEF
Marketing spend, X (%)235689
Revenue growth, Y (%)45981213

How does least squares choose the line?

Any line gives a fitted value , Y^i=b0+b1Xi\hat{Y}_i = b_0 + b_1X_i, for each observation. The miss, ei=Yi−Y^ie_i = Y_i - \hat{Y}_i, 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.

SSE=∑i=1n(Yi−Y^i)2=∑ei2SSE = \sum_{i=1}^{n} (Y_i - \hat{Y}_i)^2 = \sum e_i^2

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.

Slope coefficient Memorize
b1=∑(Xi−Xˉ)(Yi−Yˉ)∑(Xi−Xˉ)2=Cov(X,Y)Var(X)b_1 = \frac{\sum (X_i-\bar{X})(Y_i-\bar{Y})}{\sum (X_i-\bar{X})^2} = \frac{\text{Cov}(X,Y)}{\text{Var}(X)}
Intercept Memorize
b0=Yˉ−b1Xˉb_0 = \bar{Y} - b_1\bar{X}

The second formula says the fitted line always passes through the point of means, (Xˉ,Yˉ)(\bar{X}, \bar{Y}).

Rearrange itRegression slope: solve for any one
The question asks for
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

On your calculator
  1. 9.7÷7.5=
  1. 9.7ENTER7.5÷

ENTER enter (on the HP, puts the number on the stack)

Rearrange itRegression intercept: solve for any one
The question asks for
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

On your calculator
  1. 8.5−(1.2933×5.5)=
  1. 8.5ENTER1.2933ENTER5.5×−

ENTER enter (on the HP, puts the number on the stack)

InteractiveDrag the line: make the squares as small as you can

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.

0481216Revenue growth (%)0246810Marketing spend (% of sales)Your line

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.

Your SSE (total square area)12.00
Least-squares SSE (the minimum)2.77
Your lineŶ = 2.00 + 1.00X
Sum of your residuals6.00
Show
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.

b₀ and b₁ on your calculator (two-variable statistics)
  1. 2NDDATA2NDCLR WORKclear old data
  2. 2ENTER↓4ENTER↓X01, Y01
  3. 3ENTER↓5ENTER↓X02, Y02
  4. 5ENTER↓9ENTER↓X03, Y03
  5. 6ENTER↓8ENTER↓X04, Y04
  6. 8ENTER↓12ENTER↓X05, Y05
  7. 9ENTER↓13ENTER↓X06, Y06
  8. 2NDSTATpress 2ND SET until LIN shows
  9. ↓↓↓↓↓↓↓↓a = 1.3867 (intercept)
  10. ↓b = 1.2933 (slope)
  11. ↓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

  1. fCLEAR Σ
  2. 4ENTER2Σ+Y first, then X
  3. display1
  4. 5ENTER3Σ+Y first, then X
  5. display2
  6. 9ENTER5Σ+Y first, then X
  7. display3
  8. 8ENTER6Σ+Y first, then X
  9. display4
  10. 12ENTER8Σ+Y first, then X
  11. display5
  12. 13ENTER9Σ+Y first, then X
  13. display6
  14. 0gŷ,rSTO7a = 1.3867 (intercept: ŷ at x = 0
  15. storeitinR7,sinceΣ+keepsnandthesumsinR1toR6)
  16. x≷yr = 0.9786
  17. 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

Least squares is the line with the smallest total area of squared misses.

Dividing the covariance by both standard deviations gives the correlation, rr. Dividing by the variance of X alone gives the slope. So the two are linked by the ratio of standard deviations.

Slope from the correlation Use it
b1=r sYsXb_1 = r\,\frac{s_Y}{s_X}

For the six retailers r=0.9786r = 0.9786, sY=3.62s_Y = 3.62 and sX=2.74s_X = 2.74, and 0.9786×3.62÷2.74=1.290.9786 \times 3.62 \div 2.74 = 1.29. A positive correlation always means a positive slope, and the slope is in units of Y per unit of X, while rr has no units.

What are the residuals telling you?

Put the fitted line next to the data and each retailer has a residual.

RetailerXYFitted ŶResidual e
A243.970.03
B355.27−0.27
C597.851.15
D689.15−1.15
E81211.730.27
F91313.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

ItemWhat to know
ModelYi=b0+b1Xi+εiY_i = b_0 + b_1X_i + \varepsilon_i
Slopeb1=Cov(X,Y)÷Var(X)b_1 = \text{Cov}(X,Y) \div \text{Var}(X)
Interceptb0=Yˉ−b1Xˉb_0 = \bar{Y} - b_1\bar{X}
Residualei=Yi−Y^ie_i = Y_i - \hat{Y}_i (actual − fitted)
Criterionminimize ∑ei2\sum e_i^2 (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.

The parts of a simple linear regression
Y = b₀ + b₁X + εone explained variable, one explaining variable
  • 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
Simple linear regression model Memorize
Yi=b0+b1Xi+εiY_i = b_0 + b_1 X_i + \varepsilon_i
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.

On your calculator
  1. 1.29×4+1.39= 6.55
  1. 1.29ENTER4×1.39+ 6.55

ENTER enter (on the HP, puts the number on the stack)

Slope coefficient Memorize
b1=∑(Xi−Xˉ)(Yi−Yˉ)∑(Xi−Xˉ)2=Cov(X,Y)Var(X)b_1 = \dfrac{\sum (X_i-\bar{X})(Y_i-\bar{Y})}{\sum (X_i-\bar{X})^2} = \dfrac{\text{Cov}(X,Y)}{\text{Var}(X)}
Quick example

Cov(X, Y) = 0.0018 and Var(X) = 0.0024. Slope = 0.0018 ÷ 0.0024 = 0.75.

On your calculator
  1. 0.0018÷0.0024= 0.75
  1. 0.0018ENTER0.0024÷ 0.75

ENTER enter (on the HP, puts the number on the stack)

Intercept Memorize
b0=Yˉ−b1Xˉb_0 = \bar{Y} - b_1\bar{X}
Quick example

Ȳ = 5, X̄ = 4 and slope 0.75. Intercept = 5 − 0.75 × 4 = 2.00.

On your calculator
  1. 5−(0.75×4)= 2
  1. 5ENTER0.75ENTER4×− 2

ENTER enter (on the HP, puts the number on the stack)

Slope from the correlation Use it
b1=r sYsXb_1 = r\,\dfrac{s_Y}{s_X}
Quick example

Correlation 0.60, standard deviation of Y 5%, of X 4%. Slope = 0.60 × 5 ÷ 4 = 0.75.

On your calculator
  1. 0.6×5÷4= 0.75
  1. 0.6ENTER5×4÷ 0.75

ENTER enter (on the HP, puts the number on the stack)

How it is asked

  1. 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.

  2. 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.

  3. 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).

  4. 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.

  1. 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:

  2. 2With X̄ = 4% and Ȳ = 5%, and the slope from the previous question (0.75), the intercept is closest to:

  3. 3The least squares method chooses the regression coefficients that minimize the:

  4. 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.
Simple linear regression model Memorize
Yi=b0+b1Xi+εiY_i = b_0 + b_1 X_i + \varepsilon_i
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.

On your calculator
  1. 1.29×4+1.39= 6.55
  1. 1.29ENTER4×1.39+ 6.55

ENTER enter (on the HP, puts the number on the stack)

Slope coefficient Memorize
b1=∑(Xi−Xˉ)(Yi−Yˉ)∑(Xi−Xˉ)2=Cov(X,Y)Var(X)b_1 = \dfrac{\sum (X_i-\bar{X})(Y_i-\bar{Y})}{\sum (X_i-\bar{X})^2} = \dfrac{\text{Cov}(X,Y)}{\text{Var}(X)}
Quick example

Cov(X, Y) = 0.0018 and Var(X) = 0.0024. Slope = 0.0018 ÷ 0.0024 = 0.75.

On your calculator
  1. 0.0018÷0.0024= 0.75
  1. 0.0018ENTER0.0024÷ 0.75

ENTER enter (on the HP, puts the number on the stack)

Intercept Memorize
b0=Yˉ−b1Xˉb_0 = \bar{Y} - b_1\bar{X}
Quick example

Ȳ = 5, X̄ = 4 and slope 0.75. Intercept = 5 − 0.75 × 4 = 2.00.

On your calculator
  1. 5−(0.75×4)= 2
  1. 5ENTER0.75ENTER4×− 2

ENTER enter (on the HP, puts the number on the stack)

Slope from the correlation Use it
b1=r sYsXb_1 = r\,\dfrac{s_Y}{s_X}
Quick example

Correlation 0.60, standard deviation of Y 5%, of X 4%. Slope = 0.60 × 5 ÷ 4 = 0.75.

On your calculator
  1. 0.6×5÷4= 0.75
  1. 0.6ENTER5×4÷ 0.75

ENTER enter (on the HP, puts the number on the stack)

Questions about this lesson?

Where this comes back

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.

  1. The regression line: slope, intercept and least squares
  2. The four regression assumptions and what residual plots reveal
  3. Goodness of fit and testing the regression coefficients
  4. The ANOVA table and the standard error of estimate
  5. Predicting Y and building a prediction interval
  6. Functional forms: log-lin, lin-log and log-log models

Ask Sensei Listen instead

Questions on The regression line: slope, intercept and least squares

Learn with Sensei, out loud The voice tutor, in early access

Sensei teaches the lesson aloud and stops when you interrupt: "wait, why is the geometric mean lower?" It answers with the lesson's own example, then quizzes you by voice. Every account can try Sensei on one module, with one voice question.

USD 149 a month founding price (regular USD 199), kept for as long as you stay subscribed. Everything in Plus included.

In active development and improving every day. Send feedback · Plans and pricing

Analyst Dojo Plus

Your free review list holds 10 items.

Plus keeps everything you save, for USD 19 a month. To make room on the free plan, remove something from your review list.

See Plus

Lessons, checkpoints and the lesson questions in practice stay free. Compare plans