← Previous lessonRegression · 03 of 40

Lesson 3 · Regression

SSE, R², coefficients, and uncertainty

A fitted line is only an estimate. Learn which question each fit statistic and interval answers—and which conclusions none of them can support.

Objective: match the number to the question

By the end, you should be able to take a small regression output and evaluate fit with SSE and R², interpret a coefficient and its confidence interval in units, and choose correctly between uncertainty for an average response and uncertainty for one new observation. In an interview, the winning move is not reciting every statistic. It is naming the decision, selecting the quantity that answers it, and bounding the claim.

Keep four questions separate. How closely did this line fit this sample? asks for SSE or R². How uncertain is the estimated slope? asks for a coefficient standard error or confidence interval. What is the average outcome at a chosen input? asks for a mean-response confidence interval. Where might one new outcome land? asks for a prediction interval. Similar-looking output can answer very different questions.

Prediction gate

Which interval must be wider?

At the same input, compare uncertainty about the average outcome with uncertainty for one new outcome.

Sample R²—Reveal to inspect

The organizing idea: uncertainty grows as you move from the fitted sample, to an unknown population mean, to a single future case. R² summarizes sample fit; it is not a substitute for any interval, held-out validation, or causal evidence.

Fit begins with two piles of error

Suppose each outcome is yᵢ, its fitted value is ŷᵢ, and the sample mean is ȳ. The mean-only baseline predicts ȳ for everyone. Its total squared error is the total sum of squares, SST = Σ(yᵢ − ȳ)². The regression line's remaining squared error is the error sum of squares, SSE = Σ(yᵢ − ŷᵢ)².

With an intercept fitted by OLS, centered variation partitions into variation explained by the fitted values plus residual variation. That identity gives:

R² = 1 − SSE / SST

If SSE is one-fifth of SST, the line removed four-fifths of the squared error made by the in-sample mean baseline, so R² is .80. That is precise. “The model is 80% accurate” is not: accuracy needs a loss, scale, population, and evaluation design. Nor does R² say 80% of an outcome was caused by the predictor.

R² is unitless and cannot reveal error magnitude. Predicting annual spend within $100 may be excellent or useless depending on the business. It also never worsens when ordinary predictors are added to the same training fit, even if they add no reusable signal. On genuinely unseen data, R² can be negative: the predictions can lose to the evaluation sample's mean baseline. For deployment, report held-out errors in decision-relevant units alongside R².

Worked calculation: audit every quantity

Use the five observations from Lesson 2: x = (1,2,3,4,5) practice sessions and y = (2,3,5,4,6) skill scores. OLS gives ŷ = 1.3 + 0.9x. The complete residual calculation is inspectable:

xyŷe = y − ŷe²
122.2−0.20.04
233.1−0.10.01
354.01.01.00
444.9−0.90.81
565.80.20.04

Add the last column: SSE = 1.90 score². Because ȳ = 4, SST = (2−4)² + (3−4)² + (5−4)² + (4−4)² + (6−4)² = 4+1+1+0+4 = 10 score². Therefore R² = 1 − 1.90/10 = .81. The line removes 81% of this sample's squared error relative to always predicting 4.

SSE grows with sample size and retains squared units, so estimate the typical residual scale. Two parameters—the intercept and slope—were fitted, leaving n−2=3 residual degrees of freedom:

s = √[SSE / (n − 2)] = √(1.90 / 3) = 0.796 score points

This residual standard error estimates the conditional error standard deviation under a constant-variance model. It is not the standard error of the slope. The predictor's centered sum of squares is Sxx = Σ(xᵢ−x̄)² = 10, so SE(b₁)=s/√Sxx=.796/√10=.252 score points per session.

With only three residual degrees of freedom, the two-sided 95% critical value is t*=3.182, not 1.96. The slope interval is 0.9 ± 3.182(.252) = 0.9 ± 0.80 = [0.10, 1.70] score points per session. The estimate is positive, but a range this wide should temper claims about magnitude. A larger sample or wider, well-supported x range can improve precision; neither repairs a misspecified line.

What a coefficient interval does—and does not—say

The slope b₁=.9 says that within this fitted linear model, each additional practice session corresponds to a .9-point increase in predicted score. State outcome units per predictor unit and restrict interpretation to the supported range. The standard error describes how the estimated slope would vary across repeated samples under the model. It is not the spread of individual outcomes.

A frequentist 95% confidence procedure is calibrated so that, under its assumptions, 95% of intervals generated across repeated samples cover the fixed population slope. After one interval is computed, avoid saying there is a 95% probability that this fixed parameter lies inside it. In interview-friendly language: “Values from .10 to 1.70 are compatible with the data and model at the 95% confidence level.” Then discuss practical importance, not merely whether zero is excluded.

The interval does not prove a linear relationship, practical value, or causality. Selection, confounding, measurement error, and model misspecification can make a precisely estimated association answer the wrong question. Precision conditional on a model is not validity of the model.

One fitted value, two different intervals

At a target input x₀, the fitted line estimates the conditional mean E[Y|X=x₀]. Its standard error is smallest at x̄ and grows with distance from the data center:

SE(mean at x₀) = s √[1/n + (x₀ − x̄)²/Sxx]

The 1/n term represents uncertainty at the center. The distance term is leverage: far from x̄, small uncertainty in slope creates larger uncertainty in the fitted mean. Multiply by the appropriate t critical value to obtain the confidence margin.

One future observation varies around that unknown mean. Its standard error therefore adds a full unit of residual variance:

SE(new observation at x₀) = s √[1 + 1/n + (x₀ − x̄)²/Sxx]

That extra 1 is the mechanism behind the dominant visual: even if the average outcome were known very precisely, an individual may land far from it. At x₀=3=x̄, the fitted mean is 4. The 95% mean-response margin is 3.182(.796)√.2=1.13, giving [2.87,5.13]. The individual margin is 3.182(.796)√1.2=2.77, giving [1.23,6.77]. Same line, same x, different target.

Applied demonstration: staffing a support queue

A support lead wants to staff tomorrow's queue. One row is a resolved ticket; x is a prespecified complexity score and y is resolution time in minutes. A regression fitted to comparable recent tickets has R²=.64. At complexity 4, it estimates an average of 18 minutes, a 95% mean-response confidence interval of 16–20, and a 95% individual prediction interval of 9–27.

  1. Frame the target. For the average resolution time among many comparable complexity-4 tickets, 16–20 addresses uncertainty about a mean. For enough staffing to cover one ticket's possible duration, 9–27 is relevant.
  2. Interpret fit carefully. R²=.64 means the line removed 64% of in-sample squared variation relative to that sample's mean-only baseline. It does not mean 64% of tickets are predicted correctly.
  3. Check transport. If tomorrow includes enterprise tickets absent from training, neither interval promises 95% coverage there. The formulas quantify sampling and outcome variation under the model, not distribution shift.
  4. Bound the decision. Use predicted workload aggregated over eligible tickets, validate interval coverage on later cohorts, and preserve a service-level buffer. Do not shrink staff solely because the mean interval is narrow.

A tempting but wrong conclusion is: “Complexity explains 64% of time, so lowering the score by one will reduce resolution time.” R² is not causal, and a recorded complexity score may only describe difficult work. To evaluate an intervention, specify what can actually change—routing, tooling, or training—and use an experiment or defensible causal design.

Assumptions, failure modes, and repairs

The exact textbook intervals above rely on a linear conditional mean, independent errors, constant conditional variance, and normally distributed errors for finite-sample t inference. Predictors need not be normally distributed. OLS can still compute coefficients when error normality fails; the issue is whether the stated small-sample interval coverage is justified.

  • Nonlinearity: a straight line averages over curvature. Plot residuals against fitted values or x, then transform features or model the curve.
  • Heteroskedasticity: if outcome spread grows with x, classical standard errors and constant-width noise assumptions are wrong. Consider a variance model, transformation, or heteroskedasticity-robust coefficient standard errors. Robust SEs do not make the mean linear.
  • Dependence: repeated users, stores, or time periods can provide less independent information than n suggests. Model clusters or temporal structure rather than pretending rows are independent.
  • Influence and leverage: an extreme x can determine both slope and apparent precision. Verify it, inspect influence, and report sensitivity rather than deleting inconvenient rows automatically.
  • Extrapolation and shift: wider formulas outside the data range are warnings, not licenses. If the functional relationship changes, even a very wide textbook interval may miss systematically.
  • Small samples: t multipliers become large, and residual plots have little power. Be transparent that assumptions are hard to assess.

Nearest alternatives: choose by the decision

Use R² when you need a scale-free description of squared-error reduction against a mean baseline. Use RMSE when error magnitude in outcome units matters; use MAE when absolute-error cost is closer to the decision or large misses should not receive a quadratic penalty. Evaluate predictive measures on data that mimic deployment. A strong answer can report R² for fit and held-out MAE for operational impact without treating them as rivals.

Use a coefficient confidence interval for a population association, a mean-response interval for an average at x₀, and a prediction interval for one new response. If classical error assumptions fail, robust standard errors or bootstrap procedures may improve a coefficient's uncertainty estimate under appropriate conditions. They do not automatically provide valid individual prediction intervals, cure dependence, or remove bias from confounding.

The interview trap

Weak answer: “R²=.81 means the model is 81% accurate. The slope is significant, so another practice session causes a .9-point gain. The 95% confidence interval tells us where 95% of future scores fall.”

Why it fails: it confuses relative in-sample squared fit with accuracy, association with causation, and a coefficient interval with an outcome interval.

Corrected answer: “Relative to predicting this sample's mean, the line reduces squared error by 81%. The estimated association is .9 score points per session, with a 95% slope interval of [.10,1.70] under the model. For a future score I would calculate the wider prediction interval, validate it on comparable held-out observations, and make no causal claim without an identification strategy.”

Three checkpoints

  1. R² rises from .60 to .65 after adding a feature. Is the new model better?

    Not necessarily. Training R² cannot decrease when ordinary predictors are added. Check held-out error, stability, leakage, complexity, and whether the change matters to the decision.

  2. Why is a prediction interval wider than a mean-response interval?

    Both include uncertainty in the fitted mean. Prediction for one new observation also includes that observation's residual variation—the extra 1 under the square root.

  3. A slope interval excludes zero. What may you conclude?

    Under the sampling procedure and model assumptions, zero is not among the values compatible at that confidence level. You still have not established a large, useful, linear, or causal effect.

Interview practice bank

  1. 1. Define R² without using the word “explained.”

    Strong-answer outline: compare regression SSE with the mean-only baseline SST; R² is one minus their ratio for the stated evaluation sample. State that it is not percent accuracy or causality. Likely follow-up: can test R² be negative? Yes, when predictions lose to the evaluation mean. Signal: baseline-aware definition.

  2. 2. From SSE=18, SST=30, and n=8 in simple regression, calculate R² and residual s.

    Strong-answer outline: R²=1−18/30=.40. Two fitted parameters leave 6 degrees of freedom, so s=√(18/6)=√3≈1.73 outcome units. Likely follow-up: why not √(18/8)? Because estimating intercept and slope consumes two degrees of freedom. Signal: transparent arithmetic and units.

  3. 3. Interpret slope 2.4 with a 95% interval [0.3, 4.5].

    Strong-answer outline: specify 2.4 outcome units per predictor unit, model conditioning and observed range; the data are compatible with a small-to-large positive population slope under assumptions. Discuss practical threshold separately. Likely follow-up: is there a 95% probability the slope is in the interval? Not in the standard frequentist interpretation. Signal: bounded inferential language.

  4. 4. A model has R²=.92 but wide prediction intervals. How can both be true?

    Strong-answer outline: R² is relative variation reduction; substantial absolute residual noise can remain, especially when total outcome variation is huge. Individual intervals also include irreducible noise and widen at leverage points. Likely follow-up: what report next? RMSE/MAE in units and held-out interval coverage. Signal: separates relative fit from absolute uncertainty.

  5. 5. When would you prefer MAE to R² or RMSE?

    Strong-answer outline: when absolute deviations match business cost and large errors should not be squared; still compare on a deployment-like holdout and report units. Likely follow-up: downside? MAE is less sensitive to rare catastrophic misses that may matter operationally. Signal: loss tied to decisions.

  6. 6. Design the uncertainty statement for a delivery-time promise.

    Strong-answer outline: define eligible orders and x range; use a prediction interval or conditional quantiles for an individual delivery, validate coverage and width by time and segment, and account for shift and asymmetric late-delivery costs. Likely follow-up: what if variance rises with distance? Model conditional spread or use appropriate robust/quantile methods. Signal: translates estimand into an operational guarantee cautiously.

  7. 7. Residual spread fans out with x. What changes?

    Strong-answer outline: the conditional mean estimate may remain useful, but classical constant-variance standard errors and prediction bands are suspect. Inspect specification, consider transformation or a variance model, and use robust coefficient SEs where justified. Likely follow-up: do robust SEs fix predictions? No. Signal: diagnosis matched to repair.

Timed synthesis: four minutes

A model predicts support resolution minutes from complexity. R²=.64; at complexity 4 the fitted mean is 18, its 95% confidence interval is 16–20, and the 95% prediction interval is 9–27. Explain all three quantities, choose an interval for staffing one new ticket, name two assumptions or failure modes, and state one next validation step.

Incomplete: calls R² accuracy or chooses 16–20 for one ticket without qualification.

Competent: defines R² against the mean baseline, chooses 9–27, and names linearity plus comparable future tickets.

Strong: also distinguishes relative fit from minute-scale error, explains the added individual-noise term, discusses heteroskedasticity or shift, rejects causal language, and proposes held-out interval coverage by segment.

Interview-ready recap

  • Fit: SSE is remaining squared error; SST is mean-baseline squared error; R²=1−SSE/SST.
  • Scale: residual s is in outcome units; R² is unitless and not percent accuracy.
  • Coefficient: estimate ± t*×SE; interpret in outcome units per predictor unit.
  • Mean: confidence interval answers where the average response at x₀ may be.
  • Individual: prediction interval adds residual noise and must be wider at the same x₀.
  • Geometry: both bands widen away from x̄; extrapolation remains unsupported.
  • Boundary: none of these numbers alone establishes causality or deployment performance.

Explain without notes: draw a narrow band around a line and a wider band around it. In 60 seconds, explain the extra 1 in prediction variance. If you confuse the targets, record this error: “I used uncertainty about an average when the decision concerned an individual.” Review it today, tomorrow, then on days 3, 7, 14, and 30.