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

A statistical method for modeling the relationship between variables by fitting a line that minimizes the sum of squared distances from data points to the line.

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 finds the line that minimizes total squared prediction errors (least squares). The slope tells you how much Y changes per unit increase in X.

Common stuck point: Students extrapolate regression lines far beyond the data range. Predictions outside the observed data are unreliable because the linear relationship may not hold.

Worked Examples

Example 1

hard
A regression line is \hat{y} = 2.5 + 1.8x, where x is hours studied and \hat{y} is predicted exam score. Interpret the slope and y-intercept.

Solution

  1. 1
    Step 1: Slope = 1.8: for each additional hour studied, the predicted exam score increases by 1.8 points.
  2. 2
    Step 2: Y-intercept = 2.5: when x = 0 (no studying), the predicted score is 2.5. This may or may not be meaningful in context.
  3. 3
    Step 3: The equation predicts scores based on study hours, assuming a linear relationship.

Answer

Slope: each extra hour adds 1.8 points. Y-intercept: predicted score of 2.5 with zero hours (may not be practically meaningful).
In linear regression, the slope represents the rate of change in y per unit change in x. The y-intercept is the predicted value when x = 0, which may or may not make sense in context.

Example 2

hard
Using \hat{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 these problems on your own first, then open the solution to compare your method.

Example 1

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

Example 2

hard
A regression line is \hat{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.

Background Knowledge

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

scatter plotcorrelation introslope intercept