Why a Change of Units Should Not Change Correlation
A correlation summarizes the direction and strength of a linear relationship between paired quantitative measurements. The numerical value used to record a measurement can change without changing the underlying pattern: a time may be reported in hours or minutes, and a temperature may be reported in Celsius or Fahrenheit. These conversions shift values, multiply them by constants, or do both. This tutorial derives exactly what such changes do to Pearson’s correlation.
The key distinction is between a change of units that is an affine transformation and a more general recoding. Adding a constant or multiplying by a nonzero constant has a precise effect on correlation. A nonlinear transformation, even one that preserves the ordering of values, has no such general guarantee.
The Correlation Formula and the Transformation Rule
Suppose we observe \(n\) paired measurements \((x_i,y_i)\), for \(i=1,\ldots,n\). Let \(\bar{x}\) and \(\bar{y}\) be the sample means. Pearson’s sample correlation is the sum of the paired centered products divided by the square root of the product of the two sums of squared deviations.
We consider the same paired observations after transforming each variable by a rule of the form \(x_i'=a+bx_i\) and \(y_i'=c+dy_i\), where \(a,b,c,d\) are constants. The multipliers \(b\) and \(d\) must be nonzero: if either is zero, that transformed variable is constant, so its correlation is undefined.
Why the Rule Holds
The result follows directly from how means, centered values, and sums of squares transform. The argument is algebraic: it applies to any fixed set of paired observations satisfying the conditions in the definition, without requiring a probability model.
Because \(x_i'=a+bx_i\), its sample mean is \(\bar{x}'=a+b\bar{x}\). Likewise, \(\bar{y}'=c+d\bar{y}\).
Subtracting each transformed mean gives \(x_i'-\bar{x}'=b(x_i-\bar{x})\) and \(y_i'-\bar{y}'=d(y_i-\bar{y})\). The added constants disappear.
The centered-product sum becomes \(bd\sum_{i=1}^{n}(x_i-\bar{x})(y_i-\bar{y})\). The two sums of squared deviations become \(b^2\sum_{i=1}^{n}(x_i-\bar{x})^2\) and \(d^2\sum_{i=1}^{n}(y_i-\bar{y})^2\).
The denominator is multiplied by \(\sqrt{b^2d^2}=|b||d|\). Dividing the transformed numerator by that denominator multiplies the original correlation by \(bd/(|b||d|)\), which is \(1\) or \(-1\) according to the sign of \(bd\).
This also explains the special role of units. A conventional conversion between units uses a positive multiplier, possibly with an added constant. For example, converting hours to minutes multiplies every value by 60, while converting Celsius to Fahrenheit multiplies by \(9/5\) and adds 32. Neither operation changes the correlation when applied to just one variable with a positive multiplier.
Worked Unit Conversion
Worked Example: Hours and Celsius Become Minutes and Fahrenheit
Suppose four hypothetical paired observations record a duration \(x\), in hours, and a temperature \(y\), in degrees Celsius. The data are \(x=(1,2,3,4)\) and \(y=(2,3,5,6)\). Convert the duration to minutes and the temperature to Fahrenheit, then verify the effect on correlation.
First calculate the original correlation. The means are \(\bar{x}=2.5\) hours and \(\bar{y}=4\) degrees Celsius. The centered values are \(x_i-\bar{x}=(-1.5,-0.5,0.5,1.5)\) and \(y_i-\bar{y}=(-2,-1,1,2)\). Therefore,
So the original correlation is \(r=7/\sqrt{5\cdot10}=7/\sqrt{50}\approx0.9899\). The positive value reflects the paired pattern in these data.
The converted values are \(x_i'=60x_i\), in minutes, and \(y_i'=32+(9/5)y_i\), in degrees Fahrenheit. Here \(b=60\) and \(d=9/5=1.8\), both positive. The centered-product sum is multiplied by \(bd=108\), the \(x\) sum of squares by \(60^2=3600\), and the \(y\) sum of squares by \(1.8^2=3.24\). Thus,
The equality with the original value also follows from \(bd/(|b||d|)=1\). The converted measurements have different numerical values and units, but their correlation is unchanged.
When a Negative Multiplier Reverses the Sign
A negative multiplier reverses the direction of the numerical scale: larger original values become smaller transformed values. If only one variable is reversed in this way, pairs that previously had same-direction deviations now have opposite-direction deviations, and the correlation changes sign. If both variables are reversed, the two reversals cancel in the product of centered deviations.
Worked Example: Reversing One Scale
Use the same hypothetical data \(x=(1,2,3,4)\) and \(y=(2,3,5,6)\), but replace \(y\) with \(y'=10-y\). This could represent a score recoded so that higher original values receive lower new values. Find the new correlation.
The transformation has \(c=10\) and \(d=-1\); the \(x\) variable is unchanged, so \(b=1\). From the original calculation, the centered-product sum is 7, the \(x\) sum of squares is 5, and the \(y\) sum of squares is 10. The new centered \(y\) values are the negatives of the old ones, so the new centered-product sum is \(-7\), while the sums of squares remain 5 and 10. Direct calculation gives
The theorem gives the same conclusion: \(bd=(1)(-1)<0\), so \(r'=-r\). The sign reversal describes this recoding of the scale; it does not imply that the underlying paired observations have changed.
Worked Example: Reversing Both Scales
Again take \(x=(1,2,3,4)\) and \(y=(2,3,5,6)\), but now transform both variables: \(x'=7-2x\) and \(y'=10-3y\). Calculate the correlation from the transformed sums.
The multipliers are \(b=-2\) and \(d=-3\). The original centered-product sum is 7, and the original sums of squares are 5 and 10. Therefore, the transformed centered-product sum is \((-2)(-3)(7)=42\). The transformed sums of squares are \((-2)^2(5)=20\) and \((-3)^2(10)=90\). Hence,
Both multipliers are negative, so \(bd=6>0\). The sign is preserved, and the correlation equals the original value. The constants 7 and 10 do not affect the centered values.
Common Mistake: Confusing Order With Correlation
The sign rule is not a rule about whether a recoding preserves or reverses the ordering of observations. It applies to the particular affine transformations \(a+bx\) and \(c+dy\). A nonlinear recoding can preserve the order of every observation and still change both the magnitude and the sign of Pearson’s correlation.
Worked Example: An Increasing Recoding Can Change the Sign
Consider \(x=(1,2,3,4)\) and \(y=(1,3,4,2)\). Both means are 2.5. The centered-product sum is \(2.25-0.25+0.75-0.75=2\), and each variable has a sum of squared deviations equal to 5. Thus the original correlation is \(2/\sqrt{25}=0.4\).
Now recode the \(x\) values as \(x'=(1,2,3,100)\). This recoding preserves their strict ordering, but it is not a single affine transformation of the original \(x\) values. The new mean is \(\bar{x}'=26.5\), so the centered \(x'\) values are \((-25.5,-24.5,-23.5,73.5)\). The centered \(y\) values remain \((-1.5,0.5,1.5,-0.5)\). Their products sum to
The new \(x'\) sum of squared deviations is \(650.25+600.25+552.25+5402.25=7205\); the \(y\) sum of squares remains 5. Therefore,
The ordering of the \(x\) observations was preserved, yet the correlation changed from positive to negative. The correction to the common mistake is to apply the sign rule only to affine transformations with nonzero multipliers. Preserving or reversing order alone does not determine Pearson’s correlation sign.
Why This Property Matters
The transformation rule makes correlation comparable across conventional choices of measurement units. Reporting a relationship between height and weight in inches and pounds gives the same correlation as reporting the same measurements in centimeters and kilograms, because both conversions use positive multipliers. Adding a fixed origin shift, as in Celsius-to-Fahrenheit conversion, also leaves correlation unchanged.
The rule does not mean that every alteration of recorded values leaves correlation unchanged. A nonlinear transformation can change the spacing between observations, and Pearson’s formula uses those numerical spacings through its centered products and sums of squares. The increasing recoding example shows that even the sign can change. Always distinguish a positive affine unit conversion from a different kind of recoding.
Check Your Understanding
Try these questions using the transformation rule and the definition of correlation.
- If \(x'=5+3x\) and \(y'=8+2y\), does the correlation change? Explain using the signs of the multipliers.
- If \(x'=4-x\) and \(y'=y\), how does the new correlation relate to the old one? What happens if both variables are multiplied by negative constants?
- Why must both multipliers be nonzero for the transformed correlation to be defined?
- A student argues that any increasing recoding of one variable must preserve the sign of Pearson’s correlation. What is wrong with this reasoning?
- In a unit conversion, why does adding a constant have no effect on centered deviations?