Linear Regression Examples: 43 Problems with Answers
Worked examples of Linear Regression to try before you open each solution, then practice
problems with answers.
Worked Examples
Example 1
medium
A regression model of plant height (cm) on water (mL) gives y^=0.1x+4. Interpret slope and intercept in context.Plant height vs water: ŷ = 0.1x + 4; slope = 0.1 cm/mL, intercept = 4 cm
Show solution
Answer
slope 0.1 cm/mL; intercept 4 cm at x=0
First step
1.
Slope: each additional mL of water raises predicted height by 0.1 cm.
See the full worked solution + why-it-works coaching
Setup·Key insight·Why it works·Common pitfall·Connection
Data: (xˉ,yˉ)=(5,30), sx=2, sy=8, r=0.75. Write the regression equation.Regression line ŷ = 3x + 15 passes through the centroid (x̄=5, ȳ=30)
Example 3
hard
For data with ∑x=20, ∑y=60, ∑xy=250, ∑x2=90, n=5, find the regression line.
Example 4
hard
You scale all y values by 2 but leave x unchanged. How do slope and intercept of the new regression compare to the old?
Example 5
hard
A regression line is y^=2.5+1.8x, where x is hours studied and y^ is predicted exam score. Interpret the slope and y-intercept.
Example 6
hard
Using y^=10+3x, predict y when x=5. Is it appropriate to predict for x=50 if the data ranged from x=1 to x=10?
Practice Problems
Try each one, then open the solution to compare your method.
Example 1
easy
A regression line is y^=3x+2. Predict y when x=5.Regression line ŷ = 3x + 2; find the predicted value at x = 5
Example 2
easy
In the regression equation y^=4x+9, what is the slope?
Example 3
easy
In y^=2x+6, interpret the slope in words.
Example 4
easy
Linear regression fits a line by minimizing what?
Example 5
easy
Regression line y^=−2x+30. Predict y at x=4.Regression line ŷ = −2x + 30; find the predicted value at x
Example 6
easy
In y^=5x+8, what is the intercept and what does it mean?ŷ = 5x + 8; the intercept a
Example 7
easy
Does the regression equation y^=2x+1 tell us x causes y?
Example 8
easy
Regression line y^=0.5x+10. Predict y at x=20.Regression line ŷ = 0.5x + 10; find the predicted value at x
Example 9
medium
From summary stats xˉ=10, yˉ=50, slope b=3, find the regression intercept a.
Example 10
medium
Given slope b=rsxsy with r=0.6, sy=10, sx=4, find the regression slope.
Example 11
medium
A regression of crop yield on rainfall is built from rainfall 10-40 mm. Why shouldn't it predict yield at 200 mm?
Example 12
medium
Regression line y^=2.5x+4. The number of hours studied is x and the test score is y^. How much does each extra hour raise the predicted score?Slope of ŷ = 2.5x + 4: each additional hour raises predicted score by 2.5 points
Example 13
medium
A regression of ice-cream sales on temperature shows a strong positive slope. Why is concluding 'heat causes more sales' overreaching from regression alone?
Example 14
medium
Regression predicts y^=2x+5. At x=10 the observed value is 22. Find the residual.Residual at x=10: observed y=22 vs predicted ŷ=25; residual
Example 15
medium
After fitting a regression line, the residual plot shows a clear curved pattern. What does this indicate?
Example 16
medium
A regression gives y^=1.2x+3 with r=0.9. What is R2, and what does it mean?
Example 17
medium
Regression line y^=−1.5x+40 models defects vs machine speed. Predict y^ at x=10 and state whether higher speed predicts more or fewer defects.Regression line ŷ = −1.5x + 40; predict defects at machine speed x
Regression y^=4x+2 from data with x from 1 to 6. A student predicts y^ at x=6 as 26 and at x=20 as 82. Which prediction is trustworthy and why?
Example 20
challenge
Two regression models for the same data: Model A has R2=0.95 using 1 predictor; Model B has R2=0.96 but adds 5 extra predictors. Why might Model A be preferred?
Example 21
easy
Regression line y^=6x−1. Predict y at x=4.Regression line ŷ = 6x − 1; predict ŷ at x
Example 22
easy
Regression line y^=−0.5x+12. Predict y at x=6.Regression line ŷ = −0.5x + 12; predict ŷ at x
Example 23
easy
In y^=4x+11, by how much does predicted y change when x increases by 1?Slope of ŷ = 4x + 11: predicted y rises by 4 for each unit increase in x
Example 24
easy
Regression line y^=2.5x+4. Find y^ at x=0.ŷ = 2.5x + 4; the intercept a
Example 25
medium
From xˉ=6, yˉ=20, slope b=2.5, find the regression intercept.
Example 26
medium
Given r=−0.8, sy=5, sx=2, find the regression slope.
Example 27
medium
A regression with slope b=0 produces what fitted line?
Example 28
medium
A regression slope is b=3 with sx=4 and sy=20. Find the correlation r.
Example 29
medium
Regression line y^=7x+50. Solve for x when y^=134.Regression line ŷ = 7x + 50; solve for x when ŷ
Example 30
medium
You shift all x values by +10 without changing y. Does the regression slope change?
Example 31
hard
A regression on x in [1,10] gives y^=4x+3. Predict y^ at x=100 and comment on reliability.Regression fit ŷ = 4x + 3; data range is x∈[1,10] — predictions beyond x
Example 32
hard
A perfect linear data set has r=1. What is the relation between slope b and the standard deviations sx,sy?
Example 33
hard
Why might removing one influential outlier dramatically change the regression slope?
Example 34
hard
Regression residuals are plotted vs. y^ and show a clear curved pattern. What does this suggest about the linear model?
Example 35
challenge
For data (0,1),(1,3),(2,2),(3,5),(4,4), find the least-squares regression line.Scatter plot with least-squares regression line ŷ
Example 36
hard
A regression equation is y^=50−2.3x. Interpret the slope. If x=8, find y^.
Example 37
hard
A regression line is y^=4+1.5x. Predict y when x=12, and decide whether this is interpolation if the observed x-values ranged from 5 to 15.
What to focus on
Core idea:Least squares picks the one straight line with the smallest total of squared vertical misses; its slope and intercept summarize how y changes with x in the observed data, for prediction inside that range, not as proof of cause.
Common stuck point:Students often know a procedure related to linear regression but skip the recognition step: Must you compute the least-squares slope and intercept from the data or summary statistics, then interpret them in context? That leads to a calculation or graph that looks reasonable but answers a different question.
Ask yourself:Must you compute the least-squares slope and intercept from the data or summary statistics, then interpret them in context?
Concept recap
Linear regression is a statistical method for modeling the relationship between a dependent variable and one or more independent variables by fitting a straight line that minimizes the sum of squared vertical distances from data points to the line (least squares method).
A regression line behaves like a balanced seesaw for the data: it pivots through the point of averages, and its tilt settles where the pushes from points above and below cancel, with points far from the middle having the most leverage. Unlike a seesaw, it weighs only vertical gaps, so swapping x and y gives a different line.