What the line is doing
Linear regression fits the straight line that makes the squared vertical misses as small as possible: least squares. The output is an equation, ŷ = a + bx. The slope b is the engine: the predicted change in Y for one extra unit of X. The intercept a is the predicted Y at X = 0, useful only when 0 sits inside or near the data's range.
Study hours (2 to 6) against marks (50, 55, 60, 68, 72): Sxy = 57 and Sxx = 10, so the slope is 57 ÷ 10 = 5.7 marks per hour. The intercept is 61 − 5.7 × 4 = 38.2, giving ŷ = 38.2 + 5.7x. At 7 hours the line predicts 38.2 + 5.7 × 7 = 78.1 marks. The slope test gives t = 17.73 on 3 degrees of freedom, p = 0.0004: this slope is not a coincidence of sampling.
Residuals: where the truth about the fit lives
A residual is an actual value minus its fitted value. For the student at 4 hours: fitted 61.0, actual 60, residual −1.0. The five residuals here are 0.4, −0.3, −1.0, 1.3, −0.4: small, patternless, summing to zero, as least-squares residuals always do. The residual standard deviation, s = 1.02 marks, is the typical size of a miss and the honest way to quote a prediction's accuracy. When residuals curve, funnel out, or trend, the straight line is the wrong shape and no R² can rescue it.
Extrapolation: running the line beyond the data. The hours line predicts 133 marks at 17 hours of study, on a test marked out of 100. The equation does not know where the data ended. You do.
Regression and correlation are the same data wearing two hats
With one predictor, R² equals r², and the slope equals r × (sy / sx). Correlation is symmetric (swap X and Y, same r); regression is not (the two slopes multiply to r²). Use correlation to describe association, regression to predict.
Frequently asked questions
What is the difference between the slope and the correlation?
The slope is in Y-units per X-unit and changes if you rescale. The correlation is unit-free. They always share a sign, and slope = r x (s_y / s_x).
Why least squares? Why not minimize the plain distances?
Squared misses penalize big errors heavily and lead to formulas with closed forms. The line passes through (x-mean, y-mean), and the residuals sum to zero. Absolute-distance regression exists and is used when outliers dominate.
Can I use the equation for X values outside my data?
You can compute it, but the model has never seen that territory. Relationships bend, saturate and break outside the observed range. Treat extrapolated predictions as guesses with extra confidence.
What does the intercept mean if X = 0 is impossible?
It is an anchor for the line, not a prediction. Report it, use it in the equation, and do not interpret it as a real expected value.