A simple regression fits a straight line that explains one variable with another. This lesson covers the slope and intercept, how variation splits into explained and unexplained parts, R-squared and the standard error of estimate, testing and prediction, and the assumptions that can fail.
The least squares line
A simple linear regression models a dependent variable Y with one independent variable X:
Y_i = b_0 + b_1 x X_i + e_i
where b_0 is the intercept, b_1 the slope and e_i the residual (the part of Y the line misses). Ordinary least squares chooses the line that minimizes the sum of squared residuals, which gives:
b_1 = Cov(X, Y) / Var(X), and b_0 = mean of Y - b_1 x mean of X
so the line always passes through the two means.
Example: a building-supplies distributor compares its revenue growth (Y) with the change in local housing starts (X) over five years. X: 1, 3, 5, 7, 9. Y: 2, 5, 4, 8, 11 (all in %). The means are 5 and 6. The cross-products of deviations sum to 42 and the squared X deviations to 40, so b_1 = 42 / 40 = 1.05 and b_0 = 6 - 1.05 x 5 = 0.75. Each extra point of housing-start growth goes with 1.05 points of revenue growth; the intercept is the fitted Y when X is zero.
Splitting the variation
| Measure | Definition | Example |
|---|---|---|
| Total sum of squares (SST) | Sum of (Y - mean of Y)^2 | 50 |
| Regression sum of squares (SSR) | Sum of (fitted Y - mean of Y)^2 | 44.1 |
| Residual sum of squares (SSE) | Sum of (Y - fitted Y)^2 | 5.9 |
SST = SSR + SSE. The coefficient of determination, R-squared, is the share explained: SSR / SST = 44.1 / 50 = 0.88. With one X it equals the squared correlation between X and Y.
The standard error of estimate (SEE) measures the typical size of a residual:
SEE = sqrt[SSE / (n - 2)] = sqrt(5.9 / 3) = 1.40
The divisor is n - 2 because two parameters were estimated. A smaller SEE means a tighter fit.
Testing and predicting
To test whether the slope differs from zero, divide b_1 by its standard error, s_b1 = SEE / sqrt(sum of squared X deviations) = 1.402 / sqrt(40) = 0.2217, giving t = 1.05 / 0.2217 = 4.74, compared with a t critical value with n - 2 degrees of freedom. The F-statistic, MSR / MSE = (44.1 / 1) / (5.9 / 3) = 22.42, tests the same thing; with one X, F equals t^2.
A prediction plugs a value of X into the line: at X = 6, fitted Y = 0.75 + 1.05 x 6 = 7.05%. The uncertainty around a prediction is larger than the SEE alone and grows the further X is from its mean. Predictions far outside the range of the data are guesses.
Assumptions and where they fail
The usual tests rely on these assumptions:
- The relation between X and Y is linear in the parameters.
- The residuals average zero and are unrelated to X, which is measured without error.
- The residuals have a constant variance at every level of X (homoskedasticity).
- The residuals are independent of one another; in time series, no serial correlation.
- The residuals are normally distributed, which matters most for tests in small samples.
When residual spread grows or shrinks with X (heteroskedasticity), or residuals follow each other over time, the coefficients are still unbiased but the standard errors are wrong, so t-tests mislead. A curved pattern in the residuals means the straight line is the wrong form; a transformation such as taking the log of Y, X or both may fit. A few outliers can drive the whole line. R-squared can be high even when the line is the wrong shape, so look at a residual plot as well. And a strong fit shows association, not that X causes Y.
On the exam
- Slope is covariance over the variance of X, not the reverse.
- R-squared is SSR / SST; SSE / SST is the unexplained share.
- SEE divides SSE by n - 2 and takes the square root.
- Heteroskedasticity affects standard errors and tests, not the coefficient estimates.
- Patterned residuals mean a misspecified line, whatever R-squared says.