What is linear regression?
Linear regression finds the line of best fit: the straight line ŷ = a + bx that comes closest to all your points, in the sense that the squared vertical gaps between the points and the line add up to as little as possible. That is why it is also called the least-squares line.
The slope b says how much y changes, on average, for each 1 more in x. For the exam scores, each extra point on the third exam goes with 4.83 more points on the final, on average. Use the line only for x values inside your data: these scores run from 65 to 75, so predicting for 50 isn’t reliable.
Source OpenStax · Introductory Statistics 2e, 12.3 The Regression Equation ↗
How to calculate linear regression
Here it is with your numbers:
- There are 11 pairs.
- x̄ = 761 ÷ 11
- x̄ = 69.1818
- ȳ = 1,765 ÷ 11
- ȳ = 160.4545
- Σ(x − x̄)² = 81.6364
- Σ(x − x̄)(y − ȳ) = 394.0909
- b = 394.0909 ÷ 81.6364
- b = 4.8274
- a = ȳ − b × x̄
- a = −173.5134
It means the line ŷ = 4.8274x − 173.5134 predicts 178.8864 when x is 73.
What r and r² mean
The correlation coefficient r is always between −1 and 1. Close to 1 or −1 means the points sit close to a straight line; close to 0 means there is little straight-line link. Its sign matches the slope: positive when y rises with x, negative when it falls.
r², the coefficient of determination, is the share of the variation in y that the line explains. An r² of 0.4397 means the line explains about 44% of it; the other 56% is the scatter around the line. A strong correlation doesn’t mean x causes y.
Your points and the line
| x | y | Line’s ŷ |
|---|---|---|
| 65 | 175 | 140.2673 |
| 67 | 133 | 149.922 |
| 71 | 185 | 169.2316 |
| 71 | 163 | 169.2316 |
| 66 | 126 | 145.0947 |
| 75 | 198 | 188.5412 |
| 67 | 153 | 149.922 |
| 70 | 163 | 164.4042 |
| 71 | 159 | 169.2316 |
| 69 | 151 | 159.5768 |
| 69 | 159 | 159.5768 |
FAQs
What is the formula for linear regression?
The line is ŷ = a + bx, with slope b = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)² and intercept a = ȳ − b × x̄, where x̄ and ȳ are the averages. For OpenStax’s exam scores the line is ŷ = −173.51 + 4.83x.
Source OpenStax · Introductory Statistics 2e, 12.3 The Regression Equation ↗
Is linear regression just y = mX + b?
Yes, the result is a straight line y = mx + b (statistics books often write ŷ = a + bx, with b the slope). What regression adds is how the line is chosen: it is the one with the smallest sum of squared errors, the vertical gaps between the points and the line.
How is R^2 calculated?
Square the correlation coefficient r. r = [nΣxy − ΣxΣy] ÷ √([nΣx² − (Σx)²][nΣy² − (Σy)²]). For the exam scores r is 0.6631, so r² is 0.4397: the line explains about 44% of the variation in final exam scores.
Does your line of best fit have to start at 0?
No. The line always passes through the point of averages (x̄, ȳ), and it crosses the y-axis wherever that puts it. For the exam scores it crosses at −173.51, far below 0.
How to do a line of best fit on TI-84?
Put the x values in L1 and the y values in L2 (STAT, EDIT). Then press STAT, choose TESTS, then LinRegTTest, set Xlist to L1 and Ylist to L2, and Calculate. The screen shows a and b for y = a + bx, with r² and r at the bottom.