Linear Regression Examples in Statistics

Start with the recap, study the fully worked examples, then use the practice problems to check your understanding of Linear Regression.

This page combines explanation, solved examples, and follow-up practice so you can move from recognition to confident problem-solving in Statistics.

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 distances from data points to the line (least squares method).

Given scattered points, draw the 'best' line through them. 'Best' means the line that's closest to all points on average. This line lets you predict Y from X.

Read the full concept explanation →

How to Use These Examples

  • Read the first worked example with the solution open so the structure is clear.
  • Try the practice problems before revealing each solution.
  • Use the related concepts and background knowledge badges if you feel stuck.

What to Focus On

Core idea: Linear Regression asks whether the same cases connect two variables or groups in a pattern that can be described carefully.

Common stuck point: Students often know a procedure related to linear regression but skip the recognition step: Am I studying a relationship between variables, and have I separated association from causation? That leads to a calculation or graph that looks reasonable but answers a different question.

Sense of Study hint: Ask: Am I studying a relationship between variables, and have I separated association from causation?

Worked Examples

Example 1

medium
A regression model of plant height (cm) on water (mL) gives y^=0.1x+4\hat{y} = 0.1x + 4. Interpret slope and intercept in context.

Answer

slope 0.1 cm/mL; intercept 4 cm at x=0\text{slope }0.1\text{ cm/mL; intercept }4\text{ cm at }x=0

First step

1
Slope: each additional mL of water raises predicted height by 0.10.1 cm.

See the full worked solution + why-it-works coaching

SetupKey insightWhy it worksCommon pitfallConnection

Unlock answer keys One Family plan — every worked solution, all subjects

Example 2

medium
Data: (xˉ,yˉ)=(5,30)\bar{x},\bar{y}) = (5, 30), sx=2s_x = 2, sy=8s_y = 8, r=0.75r = 0.75. Write the regression equation.

Example 3

hard
For data with x=20\sum x = 20, y=60\sum y = 60, xy=250\sum xy = 250, x2=90\sum x^2 = 90, n=5n = 5, find the regression line.

Example 4

hard
You scale all yy values by 22 but leave xx 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\hat{y} = 2.5 + 1.8x, where xx is hours studied and y^\hat{y} is predicted exam score. Interpret the slope and y-intercept.

Example 6

hard
Using y^=10+3x\hat{y} = 10 + 3x, predict yy when x=5x = 5. Is it appropriate to predict for x=50x = 50 if the data ranged from x=1x = 1 to x=10x = 10?

Practice Problems

Try these problems on your own first, then open the solution to compare your method.

Example 1

easy
A regression line is y^=3x+2\hat{y} = 3x + 2. Predict y when x=5x = 5.

Example 2

easy
In the regression equation y^=4x+9\hat{y} = 4x + 9, what is the slope?

Example 3

easy
In y^=2x+6\hat{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\hat{y} = -2x + 30. Predict y at x=4x = 4.

Example 6

easy
In y^=5x+8\hat{y} = 5x + 8, what is the intercept and what does it mean?

Example 7

easy
Does the regression equation y^=2x+1\hat{y}=2x+1 tell us x causes y?

Example 8

easy
Regression line y^=0.5x+10\hat{y}=0.5x+10. Predict y at x=20x=20.

Example 9

medium
From summary stats xˉ=10\bar{x}=10, yˉ=50\bar{y}=50, slope b=3b=3, find the regression intercept aa.

Example 10

medium
Given slope b=rsysxb=r\frac{s_y}{s_x} with r=0.6r=0.6, sy=10s_y=10, sx=4s_x=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\hat{y}=2.5x+4. The number of hours studied is x and the test score is y^\hat{y}. How much does each extra hour raise the predicted score?

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\hat{y}=2x+5. At x=10x=10 the observed value is 22. Find the 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\hat{y}=1.2x+3 with r=0.9r=0.9. What is R2R^2, and what does it mean?

Example 17

medium
Regression line y^=1.5x+40\hat{y}=-1.5x+40 models defects vs machine speed. Predict y^\hat{y} at x=10x=10 and state whether higher speed predicts more or fewer defects.

Example 18

challenge
Data: xˉ=5\bar{x}=5, yˉ=20\bar{y}=20, sx=2s_x=2, sy=8s_y=8, r=0.75r=0.75. Write the regression equation y^=a+bx\hat{y}=a+bx.

Example 19

challenge
Regression y^=4x+2\hat{y}=4x+2 from data with x from 1 to 6. A student predicts y^\hat{y} at x=6x=6 as 26 and at x=20x=20 as 82. Which prediction is trustworthy and why?

Example 20

challenge
Two regression models for the same data: Model A has R2=0.95R^2=0.95 using 1 predictor; Model B has R2=0.96R^2=0.96 but adds 5 extra predictors. Why might Model A be preferred?

Example 21

easy
Regression line y^=6x1\hat{y} = 6x - 1. Predict yy at x=4x = 4.

Example 22

easy
Regression line y^=0.5x+12\hat{y} = -0.5x + 12. Predict yy at x=6x = 6.

Example 23

easy
In y^=4x+11\hat{y} = 4x + 11, by how much does predicted yy change when xx increases by 11?

Example 24

easy
Regression line y^=2.5x+4\hat{y} = 2.5x + 4. Find y^\hat{y} at x=0x = 0.

Example 25

medium
From xˉ=6\bar{x}=6, yˉ=20\bar{y}=20, slope b=2.5b = 2.5, find the regression intercept.

Example 26

medium
Given r=0.8r = -0.8, sy=5s_y = 5, sx=2s_x = 2, find the regression slope.

Example 27

medium
A regression with slope b=0b = 0 produces what fitted line?

Example 28

medium
A regression slope is b=3b = 3 with sx=4s_x = 4 and sy=20s_y = 20. Find the correlation rr.

Example 29

medium
Regression line y^=7x+50\hat{y} = 7x + 50. Solve for xx when y^=134\hat{y} = 134.

Example 30

medium
You shift all xx values by +10+10 without changing yy. Does the regression slope change?

Example 31

hard
A regression on xx in [1,10][1,10] gives y^=4x+3\hat{y} = 4x + 3. Predict y^\hat{y} at x=100x = 100 and comment on reliability.

Example 32

hard
A perfect linear data set has r=1r = 1. What is the relation between slope bb and the standard deviations sx,sys_x,s_y?

Example 33

hard
Why might removing one influential outlier dramatically change the regression slope?

Example 34

hard
Regression residuals are plotted vs. y^\hat{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)(0,1),(1,3),(2,2),(3,5),(4,4), find the least-squares regression line.

Example 36

hard
A regression equation is y^=502.3x\hat{y} = 50 - 2.3x. Interpret the slope. If x=8x = 8, find y^\hat{y}.

Example 37

hard
A regression line is y^=4+1.5x\hat{y} = 4 + 1.5x. Predict yy when x=12x = 12, and decide whether this is interpolation if the observed x-values ranged from 5 to 15.

Background Knowledge

These ideas may be useful before you work through the harder examples.

stat scatter plotcorrelation introline of best fit