Checking a regression after one paired observation is repeated
Repeat one complete x-y pair in a dataset and an ordinary least-squares line shifts toward it. This worksheet shows how far, and why the slope can stay put while the intercept moves.
What repeating a row does to least squares
Ordinary least squares treats every row of the list as one observation and minimizes the sum of squared vertical gaps between the points and the line. If a pair appears twice, its squared gap is counted twice, so the fit is pulled toward that location with double the force. Nothing about the underlying process has changed; only the supplied data has. That matters in practice because duplicated rows arrive by accident (a double import, a merged spreadsheet, a copied block) and also on purpose (a second reading at the same setting). The calculator cannot tell the difference. It receives a list of x values and a list of y values and computes the textbook slope and intercept from them, so any repetition you type becomes extra weight.
The three-point baseline
Take the pairs (0, 0), (1, 2) and (2, 1). The mean of x is 1 and the mean of y is 1. The deviations of x are -1, 0 and 1, and the deviations of y are -1, 1 and 0. The sum of products is 1 and the sum of squared x deviations is 2, so the slope is 1 divided by 2, which is 0.5. The intercept is the mean of y minus the slope times the mean of x, or 1 - 0.5 × 1 = 0.5. The line therefore predicts 1.0 at x = 1, while the observed response there is 2, a residual of +1. That middle point sits above the line, and it is the one we will repeat.
Why the slope holds and the intercept moves
Repeat the middle pair and the lists become x = 0, 1, 1, 2 and y = 0, 2, 2, 1. The mean of x is still 1, but the mean of y rises to 1.25. The new deviations of y are -1.25, 0.75, 0.75 and -0.25, and the sum of products with the x deviations is -1 × -1.25 + 0 + 0 + 1 × -0.25 = 1. The slope is again 1 / 2 = 0.5. The extra row sits exactly at the mean of x, so its x deviation is zero and it adds nothing to either sum in the slope formula. The intercept becomes 1.25 - 0.5 = 0.75. The fitted value at x = 1 climbs from 1.0 to 1.25, closer to the observed 2.
Repeating a pair at the edge of the x range
A repeated pair away from the mean of x can change both coefficients. Duplicate the last pair, (2, 1), to get x = 0, 1, 2, 2 and y = 0, 2, 1, 1. The mean of x is now 1.25 and the mean of y is 1. The sum of squared x deviations is 2.75 and the sum of products is 1, so the slope falls to about 0.3636. The intercept is 1 - 0.3636 × 1.25, about 0.5455. Duplicating the first pair, (0, 0), instead gives x = 0, 0, 1, 2 and y = 0, 0, 2, 1, with slope about 0.6364 and intercept about 0.2727. Same data, different repeated row, opposite effect on the slope. Rows near the ends of the x range have more leverage than rows near its middle.
Three copies instead of two
Weight keeps growing as copies accumulate. Put the middle pair in three times, x = 0, 1, 1, 1, 2 and y = 0, 2, 2, 2, 1. The mean of x is 1 and the mean of y is 1.4. The sum of products is -1 × -1.4 + 0 + 0 + 0 + 1 × -0.4 = 1, the sum of squared x deviations is 2, and the slope is still 0.5. The intercept is 1.4 - 0.5 = 0.9. Across the three versions the intercept walks from 0.5 to 0.75 to 0.9 while the slope stays at 0.5. The fitted level at x = 1 heads toward 2, the repeated response, but each added copy moves it by less than the one before. The line approaches the repeated point without ever being forced through it.
Reading the comparison in a report
When you compare a fit before and after a repetition, state which rows were repeated and why. A change in intercept with an unchanged slope, as in the middle-row case, tells you the repeated point lay at the mean of x. A change in both coefficients tells you it lay elsewhere. Neither result says the new line is better or worse; it says the weighting of the data changed. If the repeated row is a genuine second observation, the heavier weight is legitimate and the new line describes a bigger sample. If it is an accidental duplicate, the original three-row fit is the correct one and the second fit describes a mistake.
Settling whether a repeat is real
Check the source before deleting anything. Look for an identifier, a timestamp, a sample label or a measurement sequence number that makes the two rows distinct. Identical values in every field, including those identifiers, usually mean a duplicate import. Identical x and y values with different identifiers can still be genuine, for example two instrument readings that agree. Keep x and y together when you filter, because removing a value from one list and not the other misaligns every pair after it and the calculator will pair the leftovers positionally. Record the rule you applied, so another reader can reproduce the cleaned dataset from the raw file.
What this worksheet does not claim
The numbers here come from ordinary unweighted least squares on short finite lists, and the calculator reports only the slope and intercept. Three or four points are far too few to support a trend or a prediction, and the example exists to expose arithmetic, not to model a real process. The page does not test whether a straight line suits the data, does not estimate uncertainty, and does not offer a weighted fit, which would be the right tool when repeated rows should count once or when measurements have unequal precision. Treat the comparison as a way to understand how the supplied rows drive the result.
Predicting the effect of a repeat before refitting
You can anticipate the direction of the change with a short check. Compute the mean of x for the current list. A repeated row whose x equals that mean leaves the slope alone and pulls the line vertically toward its y value. A repeated row whose x lies above the mean tilts the line toward that row, and a row below the mean does the same from the other side. Here the mean of x is 1, so the middle repeat only lifts the line, while the repeats of (2, 1) and (0, 0) change the tilt in opposite directions. The pull is larger when the repeated y value is far from the current line, which is why a point with a residual of +1 shifted the intercept noticeably.
Reproduce the checks
Original paired list
Open the Linear Regression Calculator and enter:
- X observations
0,1,2- Y observations
0,2,1
Expected output:
Slope
0.5Intercept
0.5Every supplied pair appears once.
Middle pair repeated
Open the Linear Regression Calculator and enter:
- X observations
0,1,1,2- Y observations
0,2,2,1
Expected output:
Slope
0.5Intercept
0.75The repeated pair changes the response mean.
References and implementation scope
The examples describe the behavior of the linked Computandum tools. A successful local check does not establish that another application accepts the same format or applies the same limits.
Sources
- Primary definition and convention reference ↗ · 2026-10-08