Fit a line and inspect what it misses
How much can one observation change a fitted trend?
Entering midway? A residual is observed output minus predicted output. Least squares chooses the line with the smallest sum of squared residuals.
Start with a concrete question
Original synthetic pairs (1,2),(2,4),(3,6),(4,8) can include a fifth point (5, adjustable y). Inspect fitted slope, residuals and extrapolation.
Try the initial inputs, then write a prediction before changing one setting. All calculations run locally on your CPU.
Go directly to the experiment · Review prerequisite mathematics and return here
What do you expect?
Predict whether changing the fifth point affects only its own residual.
Change one thing. Inspect what happens.
- Verify the exact line at default settings.
- Move the fifth output to 20 and inspect every residual.
- Exclude it and explain what evidence would justify exclusion independently of wanting a cleaner line.
Your settingsMechanism
Calculation belowEvidence
Compare outcomes
Observed points, fitted line and extrapolation
Horizontal: x. Vertical: y.
- 1. Observed data (points)
- 2. Least-squares line (extends beyond observed range) (dashed line)
Axes use the displayed ranges.
Read plotted values as a table
| Series | x | y |
|---|---|---|
| Observed data | 1 | 2 |
| Observed data | 2 | 4 |
| Observed data | 3 | 6 |
| Observed data | 4 | 8 |
| Observed data | 5 | 10 |
| Least-squares line (extends beyond observed range) | 0 | 0 |
| Least-squares line (extends beyond observed range) | 6 | 12 |
Follow the calculation
- Original synthetic pairs: (1,2), (2,4), (3,6), (4,8), (5,10).
- Means x=3, y=6. Cross-deviation sum 20; squared-x-deviation sum 10.
- Slope = 20/10 = 2; intercept = 6 − 2×3 = 0.
- Residuals: 0, 0, 0, 0, 0; squared sum = 0.
Least squares fits observed association. A changed extreme point can change the slope; removing it needs a data-quality reason, not a preferred conclusion.
Captures keep your inputs, prediction and observation. Results are recalculated from those inputs. Resetting inputs keeps your captures and challenge history.
Explain the mechanism
Fit a line and inspect what it misses
Recap for entering here
A residual is observed output minus predicted output. Least squares chooses the line with the smallest sum of squared residuals.
The concrete question
Original synthetic pairs (1,2),(2,4),(3,6),(4,8) can include a fifth point (5, adjustable y). Inspect fitted slope, residuals and extrapolation.
Predict whether changing the fifth point affects only its own residual.
Work through the mechanism
Least squares balances errors across all included observations. It does not promise that the chosen relationship is causal.
For the default points y=2x exactly, slope is 2, intercept 0 and every residual is zero.
With fifth output 20, mean x=3 and mean y=8. Cross-deviation sum is 40 and squared-x-deviation sum 10, so slope=4 and intercept=−4. Predictions change for all included x values.
Formula and symbols
Slope b=Σ(x−x̄)(y−ȳ)/Σ(x−x̄)²; intercept a=ȳ−bx̄; residual eᵢ=yᵢ−(a+bxᵢ). Overbars denote sample averages.
Test the idea
Verify the exact line at default settings.
Move the fifth output to 20 and inspect every residual.
Exclude it and explain what evidence would justify exclusion independently of wanting a cleaner line.
Assumptions and boundaries
No causal identification, confidence band or distributional error model is supplied.
Prediction at x=6 extrapolates beyond observed inputs and needs additional validation.
Extend your investigation
High school: Plot an invented scatterplot and explain residuals in its units.
College: Implement least squares and test constant-x degeneracy before extending to multiple regression.
Working professionals: Audit a trend claim for influential observations, extrapolation and confounding.
Try a fresh case
A fitted line is y=3x−1. At x=4 the observed y is 14. What is the residual?
This is a public practice check. Retries support learning; matching a number does not certify independent proficiency.
Take the investigation further
Choose any extension. These are project prompts for you to carry out; they are not automatically assessed.
School investigation
Plot an invented scatterplot and explain residuals in its units.
College investigation
Implement least squares and test constant-x degeneracy before extending to multiple regression.
Workplace investigation
Audit a trend claim for influential observations, extrapolation and confounding.
Keep the evidence, choose your next step
Completion records your own decision that you have worked through this investigation. Practice checks and independent project evidence are separate.