DESCRIPTIVE DATA CHECKS

Checking fitted coefficients after a response-unit conversion

Convert every y value with a positive scale and an offset, and the fitted line changes in a fixed way. Use this worksheet to check that a converted fit keeps the conversion.

The algebra of converting a response

Suppose a fit gives y = m x + c, and every response is replaced by y' = a y + b with a greater than zero. Then y' = a(m x + c) + b = (a m) x + (a c + b). The new slope is the old slope times the scale a, and the new intercept is the old intercept times a plus the offset b. The predictor values play no part in the conversion, so they stay as they were. This is why a refit does not need to be a surprise: if you know the conversion rule, you can predict both new coefficients before running the calculator, and a mismatch tells you that a value was converted wrongly or that something else in the data changed.

Scaling by 10 and adding 5

Use x = 0, 1, 2 and y = 1, 3, 5. The points lie exactly on a line, with slope 2 and intercept 1. Now convert each response with y' = 10 y + 5, which gives 15, 35 and 55. The refit returns slope 20 and intercept 15. The rule above predicts both: the slope is 10 × 2 = 20, and the intercept is 10 × 1 + 5 = 15. The offset of 5 appears only in the intercept, because adding a constant lifts every point by the same amount and cannot tilt the line. The scale of 10 appears in both coefficients, because stretching the vertical axis steepens the line and also stretches the height at x = 0.

A temperature-style conversion

A common real conversion has the same form. Celsius to Fahrenheit is F = 1.8 C + 32. If the responses 1, 3 and 5 were readings in degrees Celsius, the converted values would be 33.8, 37.4 and 41. The refit against x = 0, 1, 2 gives slope 3.6 and intercept 33.8. Check: 1.8 × 2 = 3.6, and 1.8 × 1 + 32 = 33.8. The interpretation of the slope changes with the unit. Two degrees Celsius per step of x becomes 3.6 degrees Fahrenheit per step, since a one-degree change in Celsius is a 1.8-degree change in Fahrenheit. The offset of 32 has no effect on the slope, which is the reason temperature differences convert with the scale factor alone.

Scale without an offset, and offset without a scale

Pure scaling is the simplest case. Converting meters to millimeters multiplies each response by 1,000, so the values 1, 3 and 5 become 1,000, 3,000 and 5,000, with slope 2,000 and intercept 1,000. Both coefficients grow by the factor, and the line keeps its shape. A pure offset is the opposite. Adding 5 to each response gives 6, 8 and 10, with slope 2 and intercept 6. The slope is unchanged and the intercept moves up by 5. Seeing these two limiting cases next to the combined conversion helps you separate the roles: the scale acts on everything, while the offset acts only on the level at x = 0. The worksheet assumes a scale above zero. A negative scale would flip the sign of the slope, and a zero scale would erase the relationship, so neither belongs to an ordinary unit conversion.

Converting the predictor changes a different term

The check here covers response conversion only. If you convert the predictor instead, the algebra changes. Replace x with x' = 10 x for the same data, so x' = 0, 10 and 20 with y = 1, 3 and 5. The slope becomes 0.2, one tenth of before, because each step in x' is ten times as large, while the intercept stays at 1 because x = 0 still maps to x' = 0. Shifting the predictor by an offset moves the intercept instead, since the intercept is the value of the line at x = 0. Converting both variables together combines the two effects, and the factors then need to be worked out separately for slope and intercept before comparing fits.

Using the check on your own pipeline

This check is useful when a dataset passes through a unit conversion in a spreadsheet, a script or a data export. Fit the line before and after, then compute the expected coefficients from the conversion rule and compare. Agreement shows the conversion was applied to every response, in the right order, with the right constants. Disagreement points to a partial conversion, a rounding step, a unit label that changed without a value change, or a column that was converted twice. Rounding the converted values to few digits introduces small differences, so allow a tolerance that matches the precision you kept. A line with exact data, as in these examples, should reproduce the expected coefficients to the last digit, while measured data will not, and the tolerance should reflect that difference.

What a conversion does not do

Converting units changes the representation of the numbers, not the information in them. It does not add data, tighten a relationship or improve how well a line describes the points; the pattern of the residuals is the same up to the scale. The exact fit in the example is a property of three points that happen to lie on one line, and real measurements rarely do. The worksheet makes no claim about uncertainty, goodness of fit or the suitability of a linear model. It only verifies that the arithmetic of the fit follows the arithmetic of the conversion.

Interpreting the new slope and intercept in the new unit

After a conversion, the coefficients describe the new unit, so their meaning shifts with it. In the first example the original line says that each step of x adds 2 response units, and the converted line says that each step adds 20 converted units, because one original unit is now worth 10. The intercept of 15 is the converted response at x = 0, which is 10 × 1 + 5. A reader who sees only the converted fit needs the conversion rule to understand it. Keep the scale, the offset and the unit labels together with the coefficients, and state them whenever you report a refit. Mislabeled units are a more common cause of a wrong slope than arithmetic errors in the fit itself.

Prediction at a new x after converting

The conversion rule also carries over to predictions. At x = 3 the original line gives 2 × 3 + 1 = 7. Converting that prediction with 10 y + 5 gives 75, and the converted line gives 20 × 3 + 15 = 75, the same number. For the Fahrenheit-style example, the original prediction at x = 3 is 7 degrees Celsius, and 1.8 × 7 + 32 = 44.6, while the converted line gives 3.6 × 3 + 33.8 = 44.6. Predicting in either unit and then converting gives matching results, which makes a good end-to-end test of a pipeline: if the two routes disagree, a conversion step was applied inconsistently.

Reproduce the checks

Original response scale

Open the Linear Regression Calculator and enter:

X observations
0,1,2
Y observations
1,3,5

Expected output:

Slope

2

Intercept

1

The initial response rule is two x plus one.

Converted response scale

Open the Linear Regression Calculator and enter:

X observations
0,1,2
Y observations
15,35,55

Expected output:

Slope

20

Intercept

15

Both coefficients carry the supplied response conversion.

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

Related tasks