Lesson 18: Linear Regression
April 6, 2026
Review:
- Scatterplots
- Sum of Squares
Presentation:
- Linear regression (simple, bivariate)
- Calculate equation of the regression line
- y-hat = b1*x + bo
- b1 = “slope” of the line
- b0 = “y-intercept”
- Calculate Sum of Squares: SSxx, SSyy, SSxy
- b1 = SSxy/SSxx
- b0 = (∑y/n) – b1*(∑x/n)
- y-hat = b1*x + bo
- Calculate equation of the regression line
- Example 1: Lemonade Stand
- Use temperature to predict sales
- Sample data
- Day 1: 70°, 45
- Day 2: 75°, 52
- Day 3: 80°, 54
- Day 4: 85°, 60
- Scatterplot
- Table setup
- columns: x, y, x^2, y^2, xy
- sums: ∑x, ∑y, ∑x^2, ∑y^2, ∑xy
- Sum of Squares calculations
- Linear Equation (slope + intercept)
- b1 = SSxy/SSxx
- b0 = (∑y/n) – b1*(∑x/n)
- Example 2: Iced Coffee Sales by Temp
- Use temperature to predict sales
- Sample data
- Day 1: 58°, 40
- Day 2: 62°, 44
- Day 3: 68°, 49
- Day 4: 72°, 53
- Day 5: 78°, 59
- Day 6: 82°, 63
- Day 7: 88°, 67
- Day 8: 92°, 73
- Scatter Plot
- Table setup
- columns: x, y, x^2, y^2, xy
- sums: ∑x, ∑y, ∑x^2, ∑y^2, ∑xy
- Sum of Squares calculations
- SSxx = ∑x² – (∑x)²/n
- SSyy = ∑y² – (∑y)²/n
- SSxy = ∑xy – (∑x*∑y)/n
- Video: Fitting Lines to Data
Assignment:
First, go back to the problems assigned last week. Use your Sum of Squares calculations to find the equation of the regression line for each problem.
- Advertising vs. Sales (n = 8)
- SSxx = 55.5
- SSyy = 1,385.875
- SSxy = 275.75
- Training Hours vs. Productivity (n = 8)
- SSxx = 42
- SSyy = 327.5
- SSxy = 117
- Price vs. Units Sold (n = 8)
- SSxx = 1050
- SSyy = 29,400
- SSxy = –5,500
Problem 1. A food truck business tracks daily high temperature (°F) and the number of customers. Calculate Sum of Squares and the equation of the regression line.
| Day | Temp (x) | Customers (y) |
|---|---|---|
| 1 | 70 | 45 |
| 2 | 75 | 48 |
| 3 | 80 | 52 |
| 4 | 85 | 60 |
| 5 | 90 | 57 |
Problem 2. What is the relationship between vehicle age and resale value on the used car market?
| Vehicle | Age (x, Years) | Resale Value (y, $1000s) |
|---|---|---|
| 1 | 2 | 26 |
| 2 | 4 | 22 |
| 3 | 6 | 21 |
| 4 | 8 | 17 |
| 5 | 10 | 19 |
| 6 | 12 | 15 |
Problem 3. A property manager wants to estimate the relationship between unit square footage (x) and rent (y). Calculate Sum of Squares and the equation of the regression line.
| Unit | Sq Ft (x) | Rent (y, $) |
|---|---|---|
| A | 800 | 1300 |
| B | 900 | 1280 |
| C | 1000 | 1450 |
| D | 1100 | 1500 |
| E | 1200 | 1400 |
Problem 4. A delivery company tracks delivery time (x) and customer satisfaction ratings (y, 1–10 scale). Calculate Sum of Squares and the equation of the regression line.
| Delivery | Time (x, minutes) | Satisfaction (y) |
|---|
| A | 20 | 9 |
| B | 30 | 8 |
| C | 40 | 6 |
| D | 50 | 7 |
| E | 60 | 5 |