Statistics
Linear Regression
Lesson
When two variables show a roughly linear relationship, the line of best fit (also called the regression line) is the line that comes closest to all the points. Once you have it, you can predict a value of from any .
The slope and intercept formulas:
Where and are the means of the - and -values. Calculators and spreadsheets do this for you in practice; for small data sets it’s manageable by hand.
Once you have the line, prediction is just substitution — plug an value into .
Worked example 1 — fit and predict
Data: (1, 5), (2, 8), (3, 11), (4, 14). The points jump by 3 each time, so the line is exactly : slope , intercept .
To predict at :
Worked example 2 — non-perfect data
Data: (1, 3), (2, 5), (3, 4), (4, 6). Using the formulas: , .
Regression line: .
How to type your answer
A single number — slope, intercept, or a predicted value, depending on the question. Use a decimal point if needed. Examples: 3, 2.5, 17, -8.
Practice
Work through these. Stuck? Click Get a hint.
Warm-Up
Quick problems to get going.
Problem 1
Problem 2
Problem 3
Problem 4
Practice
Standard problems matching the lesson.
Problem 5
Problem 6
Problem 7
Problem 8
Problem 9
Problem 10
Problem 11
Problem 12
Problem 13
Problem 14
Challenge
Harder problems — edge cases, trickier numbers, multiple steps.
Problem 15
Problem 16
Problem 17
Problem 18
Problem 19
Problem 20
Problem 21
Problem 22
Practice
Standard problems matching the lesson.
Problem 23
A study-hours-to-grade model: y = 5x + 60. Predict the grade for a student who studies 5 hours.
Problem 24
A car's value (thousands of dollars) after x years: y = -2x + 25. Predict the value at x = 4.
Challenge
Harder problems — edge cases, trickier numbers, multiple steps.
Problem 25
Ad spend predicts sales via y = 3.5x + 12 (both in thousands of dollars). Predict sales when ad spend is 8.
Ask the tutor
Stuck on a concept? Want another example? Ask anything about this topic.
Type your own question below, or tap one of the suggestions. The tutor can re-explain the lesson, work through a specific problem with you, generate fresh practice tuned to where you are, or check your reasoning.
Quiz
Test yourself on this topic →
10 questions, no hints. About 5 minutes.