Lesson 18: Least Squares Regression
October 30, 2025
Review:
- Scatterplots
Presentation:
- Least Squares Regression
- Find a line of best fit for a set of points
- Least Squares Regression Proof: MethodLeastSquares
- 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
- Example 2: Beer Sales by Price
- Experiment with price to predict demand
- 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
- Students complete calculations
- We will use these Sum of Squares calculations (next time) to determine
- linear equation
- Pearson correlation coefficient
- R-squared
Activity:
Problem 1 – Advertising and Sales (n = 8)
A retail chain studied the link between weekly advertising spend and sales (in $1,000s).
| Week | Advertising (x) | Sales (y) |
|---|---|---|
| 1 | 6 | 64 |
| 2 | 8 | 77 |
| 3 | 10 | 85 |
| 4 | 4 | 55 |
| 5 | 7 | 72 |
| 6 | 9 | 82 |
| 7 | 3 | 50 |
| 8 | 11 | 88 |
Task:
Calculate SSxx, SSyy and SSxy
Problem 2 – Training Hours and Productivity (n = 8)
An HR analyst examined whether more employee training hours lead to higher productivity (daily packages processed per worker).
| Dept | Training Hours (x) | Productivity (y) |
|---|---|---|
| A | 5 | 46 |
| B | 8 | 54 |
| C | 4 | 42 |
| D | 6 | 49 |
| E | 10 | 59 |
| F | 3 | 40 |
| G | 9 | 57 |
| H | 7 | 51 |
Task:
Calculate SSxx, SSyy and SSxy
Problem 3 – Price and Units Sold (n = 8)
A manufacturer tested different price points to estimate demand.
| Trial | Price (x) | Units Sold (y) |
|---|---|---|
| 1 | 40 | 210 |
| 2 | 35 | 250 |
| 3 | 45 | 190 |
| 4 | 50 | 160 |
| 5 | 30 | 280 |
| 6 | 55 | 150 |
| 7 | 25 | 310 |
| 8 | 60 | 130 |
Task:
Calculate SSxx, SSyy and SSxy