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
Move a line; explain slope, intercept and vertical residuals.
Five fixed toy observations. Move only the solid line: drag the square at X = 0 for Intercept, the diamond at X = 4 for Slope, or the solid line vertically to shift it. The circles stay fixed. Use the native controls below for exact or keyboard edits.
Your line: ŷ = 0.0X + 2.0. SSE = 20.00. Point 3: X = 2, observed Y = 3, predicted Y = 2.00, residual = +1.00.
Solid indigo = your line; circles = fixed observations, with Point 3 outlined. Orange segments are signed vertical gaps at each X; their lengths show absolute residual size. A handle can coincide with an observation; moving it still changes only the line.
Predicted Y change per one X unit. The diamond pivots the line about X = 0. Use arrow keys on the slider. Press Enter or leave the number field to apply an exact edit.
Predicted Y at X = 0. The square or solid line shifts every prediction equally. Use arrow keys on the slider. Press Enter or leave the number field to apply an exact edit.
Point 3: observed 3 − predicted 2.00 = +1.00. Squared contribution = 1.00.
SSE = sum of all five squared residuals = 20.00. Signed residual sum = +8.00.
Positive residuals lie above the line; negative ones below it. Residuals are differences, not necessarily data mistakes. Signed gaps can cancel; their squares do not. SSE uses squared Y units and describes fit to these points.
Change in predicted Y per one X unit.
0.0
Hold Intercept fixed → pivot about X = 0
Predicted Y at X = 0.
2.0
Hold Slope fixed → parallel vertical shift
This is a descriptive fit to five fixed toy pairs. Neither a small SSE nor the fitted slope establishes causation or guarantees accuracy on new observations.
| Point | X | Observed Y | Predicted Y | Residual | Squared |
|---|---|---|---|---|---|
| 1 | 0 | 2 | 2.00 | 0.00 | 0.00 |
| 2 | 1 | 3 | 2.00 | +1.00 | 1.00 |
| 3 | 2 | 3 | 2.00 | +1.00 | 1.00 |
| 4 | 3 | 5 | 2.00 | +3.00 | 9.00 |
| 5 | 4 | 5 | 2.00 | +3.00 | 9.00 |
Least squares with an intercept minimizes Σ[observed Y − (Slope × X + Intercept)]² over all straight lines, not just the editable tenths grid. Slope = Σ[(X − mean X)(Y − mean Y)] / Σ(X − mean X)²; Intercept = mean Y − Slope × mean X. The five distinct X values make the denominator positive and the minimum unique. The reference parameters happen to be tenths for these prepared datasets; calculations use full precision before display.
Normality is not required to compute this descriptive minimum. No regression inference, causal estimate, loss landscape, R²/residual diagnostic model or train/test guarantee is supplied here. Straight is an exact constructed boundary where the reference residuals are zero; the scattered examples retain nonzero residuals.
NIST · Least-squares criterion and straight-line coefficients