Lesson 19: Linear Regression
November 4, 2025
Review:
- Exam 2 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: Beer Sales by Temp
- Use temperature to predict kegs sold
- Historical Data (Temp degrees F, # of kegs sold)
- Day 1: 60°, 12
- Day 2: 70°, 14
- Day 3: 80°, 16
- Day 4: 90°, 18
- Day 5: 100°, 20
- Scatter Plot
- Table setup
- Sum of Squares calculations
- SSxx = ∑x² – (∑x)²/n
- SSyy = ∑y² – (∑y)²/n
- SSxy = ∑xy – (∑x*∑y)/n
- Calculate Slope of regression line
- b1 = SSxy/SSxx
- Calculate the y-intercept
- b0 = (∑y/n) – b1*(∑x/n)
- Video: Fitting Lines to Data
Activity:
- Example 2: Beer Sales by Price
- Historical Data (Price $ # of kegs sold)
- Day 1: $90, 22
- Day 2: $100, 20
- Day 3: $110, 18
- Day 4: $120, 16
- Day 5: $130, 14
- Calculate Sum of Squares
- Calculate the slope and y-intercept
- Write the linear equation
- Historical Data (Price $ # of kegs sold)
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 small coffee shop tracks daily high temperature (°F) and the number of iced coffees sold. Calculate Sum of Squares and the equation of the regression line.
| Day | Temp (x) | Iced Coffees Sold (y) |
|---|---|---|
| 1 | 60 | 42 |
| 2 | 65 | 48 |
| 3 | 70 | 52 |
| 4 | 75 | 61 |
| 5 | 80 | 65 |
Problem 2. A local brewery tracks weekly social media ad spending and kegs sold. Calculate Sum of Squares and the equation of the regression line.
| Week | Ad Spend (x, $100’s) | Kegs Sold (y) |
|---|---|---|
| 1 | 2 | 11 |
| 2 | 3 | 15 |
| 3 | 4 | 17 |
| 4 | 5 | 20 |
| 5 | 7 | 26 |
| 6 | 9 | 30 |
Problem 3. A realtor wants to estimate the relationship between square footage (x) and listing price (y in $1000s). Calculate Sum of Squares and the equation of the regression line.
| House | Sq Ft (x) | Listing Price (y) |
|---|---|---|
| A | 1,600 | 315 |
| B | 1,850 | 344 |
| C | 2,000 | 365 |
| D | 2,300 | 399 |
| E | 2,500 | 425 |