Checking a fitted intercept after shifting the x origin
Adding the same constant to every x value leaves the fitted slope alone and moves the intercept. This worksheet fits the same three points twice and shows exactly how far the intercept travels.
What the intercept refers to
A fitted line y = slope × x + intercept reports its intercept at x = 0, wherever the x scale puts its zero. If x counts days since the start of an experiment, the intercept is the fitted value on day zero. If x is a calendar year, the intercept is the fitted value in year zero, far outside any realistic data. The intercept is therefore tied to the coordinate system as much as to the data. Shift every x value by a constant and the same cloud of points now sits at a different distance from the new origin. Nothing about the paired measurements changes, yet the number reported as the intercept does.
The original fit
Start with x = 1, 2, 3 and y = 3, 5, 7. The points lie on a straight line, and each step of 1 in x raises y by 2. The ordinary least squares slope is the sum of (x - mean x)(y - mean y) divided by the sum of (x - mean x) squared. Here the mean of x is 2, the mean of y is 5, the numerator is 4 and the denominator is 2, so the slope is 2. The intercept equals mean y minus slope times mean x, which is 5 - 2 × 2 = 1. The fitted line is y = 2x + 1, and it passes through every point exactly. Because the residuals are all zero, any change to the fitted line after the shift can only come from the coordinate change, which makes these three points a tidy test case for the transformation.
Moving x up by ten
Now add 10 to every x value, giving x = 11, 12, 13 with the same y = 3, 5, 7. The deviations from the mean of x are still -1, 0 and 1, so the numerator and denominator of the slope are unchanged and the slope remains 2. The mean of x becomes 12, so the intercept is 5 - 2 × 12 = -19. The new line is y = 2x - 19. Check it against the first point: 2 × 11 - 19 = 3, which matches the original y. The fit is the same line described from a coordinate system whose zero sits ten units further left. Plugging in x = 12, the middle of the shifted list, gives 2 × 12 - 19 = 5, which is the mean of y, as least squares requires for a line fitted with an intercept.
A rule that predicts the new intercept
If every x gains a constant c, the new intercept equals the old intercept minus the slope times c. With an old intercept of 1, a slope of 2 and c = 10, the new intercept is 1 - 2 × 10 = -19, which matches the fit. This rule follows from substituting x - c into the old equation: y = slope × (x - c) + intercept simplifies to y = slope × x + (intercept - slope × c). The slope term does not change because it multiplies the variable, not the shift. Knowing the rule lets you check a spreadsheet transformation without refitting by hand.
Shifting the other way and centering
A negative shift works the same way. Subtract 2 from every x to get x = -1, 0, 1 with y = 3, 5, 7. The slope stays 2, and the intercept becomes 1 - 2 × (-2) = 5. In this coordinate system x is centered, with a mean of 0, so the intercept equals the mean of y. Centering is a common practical step because the intercept then has a direct reading: it is the fitted y at the average x. Many analysts center or shift x for exactly that reason, and also because it can reduce numerical rounding trouble when x values are large. A centered x also makes the intercept and slope estimates uncorrelated in the usual least squares setup, which simplifies reading their uncertainties.
Why years and large offsets benefit from shifting
Suppose x holds calendar years such as 2018, 2019 and 2020. The raw intercept would describe year zero, a value with no use in reading the data and possibly a large number produced by a small slope times a large x. Subtracting a reference year such as 2018 turns the x values into 0, 1 and 2, and the intercept becomes the fitted value in the reference year. The slope is the same under both choices, so the yearly change reads the same. Only the meaning of the intercept improves. This example is illustrative, since the worksheet itself uses x = 1, 2, 3.
Reading the shifted result with care
A changed intercept does not mean a changed relationship. The fitted predictions at corresponding x positions are identical before and after the shift: the point at the original x = 3 predicts 7, and so does the point at the shifted x = 13. When you compare fits from different sources, first confirm that their x values use the same origin. A report with intercept -19 and one with intercept 1 can describe identical data. Also record the shift alongside any saved equation, since the equation by itself no longer tells a reader where x = 0 sits.
Exact line, not noisy data
The worksheet tests a coordinate transformation on three points that lie exactly on a line. It does not test noisy data, outliers or a different model form, and it makes no claim about extrapolating to x = 0 or beyond the supplied range. An intercept evaluated far from the observed x values can be a poor guide to anything real, even when the fit within the data is excellent. The check also assumes the same shift is applied to every x value. Shifting only some rows would change the shape of the data and with it the slope.
Checking a shifted fit in a spreadsheet
To confirm a coordinate shift in a spreadsheet, fit the original columns and read the slope and intercept, then add the constant to the x column and fit again. The slope should match to every displayed digit. The new intercept should equal the old intercept minus the slope times the constant, which for this worksheet is 1 - 2 × 10 = -19. If the slope changed, the shift was not applied to every row or a value was mistyped. If the intercept disagrees with the rule while the slope is right, check the sign of the constant, since subtracting a value changes the intercept in the opposite direction from adding it.
Reproduce the checks
Original coordinates
Open the Linear Regression Calculator and enter:
- X observations
1,2,3- Y observations
3,5,7
Expected output:
Slope
2Intercept
1The fitted equation is y = 2x + 1.
Shift x by ten
Open the Linear Regression Calculator and enter:
- X observations
11,12,13- Y observations
3,5,7
Expected output:
Slope
2Intercept
-19The new equation uses the shifted x coordinate.
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