AI Grounds
Open AI Grounds on a desktop
These interactive lessons need a larger screen. Please continue on a desktop or laptop computer.
AI Grounds
These interactive lessons need a larger screen. Please continue on a desktop or laptop computer.
Guided discovery
Compare the score; inspect what the residuals hide.
Eight constructed observations, not random samples. Scenario and Residual scale change the data. Model changes predictions; View changes only the coordinates.
R² 0.690 · SSE 72.00 · SST 232.00. Candidate: ŷ = 2.0X + 10.0. Observed mean 10.00.
Gray circles = observations; indigo line = selected candidate; orange vertical segments = signed residuals. Switch to Residuals to put those gaps on their own axis. A ×2 marker represents two observations at the same coordinates; none are discarded.
Construct observations around the same refitted line; this changes the data, not just a chart zoom. All patterns vanish at zero. Use arrow keys on the slider. Press Enter or leave the number field to apply an exact edit.
R² = 1 − SSE/SST = 1 − 72.00/232.00 = 0.690. Signed residual sum 0.00.
SSE sums squared observed-minus-predicted gaps. SST sums squared observed-minus-mean gaps: the error of Mean only. Both use squared Y units; R² has no units and is not a fraction of correctly classified observations.
Squared-error reduction relative to the observed mean.
0.690
1 − SSE/SST
A score alone cannot validate the model.
Sum of squared residuals of the current candidate.
72.00
Σ(observed Y − predicted Y)²
Squared error of predicting observed mean Y for every pair.
232.00
Σ(observed Y − mean Y)²
Residual patterns suggest what to investigate; they do not establish a generating law, causality, or accurate predictions on new observations. Even spread is a designed contrast, not proof of random errors.
| Point | X | Observed Y | Predicted Y | Residual | Squared gap | Squared mean gap |
|---|---|---|---|---|---|---|
| 1 | -3 | 7.00 | 4.00 | +3.00 | 9.00 | 9.00 |
| 2 | -3 | 1.00 | 4.00 | −3.00 | 9.00 | 81.00 |
| 3 | -1 | 5.00 | 8.00 | −3.00 | 9.00 | 25.00 |
| 4 | -1 | 11.00 | 8.00 | +3.00 | 9.00 | 1.00 |
| 5 | 1 | 15.00 | 12.00 | +3.00 | 9.00 | 25.00 |
| 6 | 1 | 9.00 | 12.00 | −3.00 | 9.00 | 1.00 |
| 7 | 3 | 13.00 | 16.00 | −3.00 | 9.00 | 9.00 |
| 8 | 3 | 19.00 | 16.00 | +3.00 | 9.00 | 81.00 |
Observed Y = 10 + 2X + Residual scale × pattern. The patterns each have signed sum 0, X-weighted sum 0 and squared sum 72. Refitting ordinary least squares with an intercept therefore gives slope 2 and intercept 10 for every displayed scenario and scale. The observed mean is 10. The exact engine recomputes coefficients from the paired sums.
For Fitted line, SSE = 72scale² and SST = 160 + 72scale². At zero scale, SSE is 0 and R² 1; all patterns coincide. Mean only has SSE = SST, R² 0. Shifted line deliberately adds 10 to the refitted intercept, yielding SSE = 72scale² + 800. It is a poor candidate, not an optimized fit.
The raw formula 1 − SSE/SST can be negative and cannot exceed 1 when SST is positive. For a fit with an intercept on its fitting data, the mean-only predictor is an available candidate, so the least-squares score is nonnegative. If all observed Y were constant, SST would be zero and the raw ratio undefined; this page’s constructed datasets always have SST ≥160. No finite replacement is used.
Observed Y and Residual views have separate fixed vertical scales. Identical coordinates are grouped with a multiplicity label, preserving all rows. Full-precision arithmetic precedes two-decimal sums and three-decimal R² display. There are no automatic optimizers, hypothesis tests, causal estimates or held-out performance results.
Curved residuals suggest checking the mean-function form. Widening spread suggests checking variability, but mean-function misspecification can also produce that appearance. One residual plot and a high R² are insufficient to validate a model; these deterministic examples show contrasts rather than diagnose a real population.
NIST · R² and graphical residual analysis