Tutorials › Statistical Theory I - Probability and Distribution Theory › Correlation Under Shifts and Rescaling

Variance and Covariance Structure · Tutorial 356 of 994

Correlation Under Shifts and Rescaling

Learn when affine transformations preserve correlation and why a negative scale factor can reverse its sign.

Intermediate 8 min read

What You'll Learn

  • State the conditions under which correlation is defined.
  • Derive the correlation formula for separate affine transformations.
  • Explain why shifts and positive rescaling preserve correlation.
  • Determine how negative rescaling changes the sign.
  • Verify the transformation rule with discrete and continuous examples.

Why Shifts and Rescaling Matter

A correlation describes the direction and strength of linear association without retaining the original measurement units. That raises a practical question: if a measurement is converted from one unit to another, or if a constant is added to every observation, should the correlation change? The answer depends on whether the conversion preserves or reverses direction.

For example, converting a temperature measurement from one scale to another involves a shift and a positive rescaling. Changing a variable to its negative reverses its direction. We will derive exactly how those operations affect correlation, rather than relying on intuition about a particular data set.

Definition: If \(X\) and \(Y\) have finite, strictly positive variances, their correlation is $$ \operatorname{Corr}(X,Y) = \frac{\operatorname{Cov}(X,Y)} {\sqrt{\operatorname{Var}(X)\operatorname{Var}(Y)}}. $$ The numerator and variances must be finite, and the positive-variance condition ensures the denominator is nonzero.

Consider separate affine transformations \(U=aX+b\) and \(V=cY+d\), where \(a,b,c,d\) are constants. The slopes \(a\) and \(c\) determine whether each variable’s direction is preserved or reversed. The intercepts \(b\) and \(d\) shift the values but do not change their direction.

The Affine-Transformation Rule

The familiar rules for affine transformations of variance and covariance give the key calculations. In this setting, they follow directly from centering the transformed variables:

$$ U-E[U]=a(X-E[X]), \qquad V-E[V]=c(Y-E[Y]). $$

Thus a shift disappears from each centered variable, while a scale factor remains. The variance uses the square of that factor; covariance uses the product of the two factors.

Theorem: Suppose \(X\) and \(Y\) have finite, strictly positive variances, and let \(U=aX+b\), \(V=cY+d\), with \(a\ne 0\) and \(c\ne 0\). Then \(U\) and \(V\) also have finite, strictly positive variances, and $$ \operatorname{Corr}(U,V) = \frac{ac}{|a||c|}\operatorname{Corr}(X,Y) = \operatorname{sign}(ac)\operatorname{Corr}(X,Y). $$ In particular, shifts do not change correlation. Positive scaling of both variables preserves it; scaling exactly one variable by a negative constant reverses its sign; and scaling both by negative constants preserves it.

Proof. Since \(X\) and \(Y\) have finite second moments, their affine transformations do too. Linearity of expectation gives \(E[U]=aE[X]+b\) and \(E[V]=cE[Y]+d\). Using the centered forms above,

$$ \begin{aligned} \operatorname{Cov}(U,V) &=E[(U-E[U])(V-E[V])] \\ &=E[ac(X-E[X])(Y-E[Y])] \\ &=ac\operatorname{Cov}(X,Y). \end{aligned} $$

Likewise, applying the definition of variance to each centered form gives

$$ \operatorname{Var}(U)=a^2\operatorname{Var}(X), \qquad \operatorname{Var}(V)=c^2\operatorname{Var}(Y). $$

Because \(a\) and \(c\) are nonzero and the original variances are strictly positive, both transformed variances are strictly positive. Substituting the covariance and variances into the definition of correlation yields

$$ \begin{aligned} \operatorname{Corr}(U,V) &=\frac{ac\operatorname{Cov}(X,Y)} {\sqrt{a^2\operatorname{Var}(X)c^2\operatorname{Var}(Y)}}\\ &=\frac{ac}{|a||c|} \frac{\operatorname{Cov}(X,Y)} {\sqrt{\operatorname{Var}(X)\operatorname{Var}(Y)}}\\ &=\operatorname{sign}(ac)\operatorname{Corr}(X,Y). \end{aligned} $$

Here \(\sqrt{a^2}=|a|\) and \(\sqrt{c^2}=|c|\), which accounts for the absolute values in the denominator. The sign of the product \(ac\), not just its magnitude, therefore determines whether the correlation’s sign is preserved or reversed. \(\square\)

Worked Example: A Negative Rescaling Reverses the Sign

Suppose \((X,Y)\) has three equally likely possible values: \((0,0)\), \((1,2)\), and \((2,1)\). Find the correlation after setting \(U=5-2X\) and \(V=-3+4Y\).

First calculate the means: $$ E[X]=\frac{0+1+2}{3}=1, \qquad E[Y]=\frac{0+2+1}{3}=1. $$ The deviations of \(X\) are \(-1,0,1\), while the deviations of \(Y\) are \(-1,1,0\). Therefore, $$ \operatorname{Var}(X)=\operatorname{Var}(Y) =\frac{1+0+1}{3} =\frac{2}{3}, \qquad \operatorname{Cov}(X,Y) =\frac{1+0+0}{3} =\frac{1}{3}. $$ It follows that $$ \operatorname{Corr}(X,Y) =\frac{1/3}{\sqrt{(2/3)(2/3)}} =\frac{1}{2}. $$

The transformation slopes are \(a=-2\) and \(c=4\), so \(ac=-8<0\). The theorem predicts a sign reversal. Checking the transformed moments, $$ \operatorname{Cov}(U,V)=(-8)\left(\frac{1}{3}\right)=-\frac{8}{3}, \qquad \operatorname{Var}(U)=4\left(\frac{2}{3}\right)=\frac{8}{3}, \qquad \operatorname{Var}(V)=16\left(\frac{2}{3}\right)=\frac{32}{3}. $$ Hence $$ \operatorname{Corr}(U,V) =\frac{-8/3}{\sqrt{(8/3)(32/3)}} =\frac{-8/3}{16/3} =-\frac{1}{2}. $$ The shift constants \(5\) and \(-3\) have no effect; the negative slope on \(X\) reverses the sign.

Standardized Variables Under Affine Transformations

The same result can be seen through standardization. For a random variable \(X\) with finite, strictly positive variance, define its standardized version by

$$ Z_X=\frac{X-E[X]}{\sqrt{\operatorname{Var}(X)}}. $$

It has mean zero and variance one. Correlation is the expectation of the product of the two standardized variables. For the transformed variables in the theorem, standardization gives a precise account of what shifts and signs do.

Derived result: Under the conditions of the theorem, $$ Z_U=\operatorname{sign}(a)Z_X, \qquad Z_V=\operatorname{sign}(c)Z_Y, \qquad \operatorname{Corr}(X,Y)=E[Z_XZ_Y]. $$ Thus a shift vanishes on standardizing, a positive scale leaves a standardized variable unchanged, and a negative scale changes its sign.

To verify the standardized-variable identities, use \(E[U]=aE[X]+b\) and \(\operatorname{Var}(U)=a^2\operatorname{Var}(X)\): $$ Z_U =\frac{a(X-E[X])}{|a|\sqrt{\operatorname{Var}(X)}} =\operatorname{sign}(a)Z_X. $$ The calculation for \(Z_V\) is identical with \(c\) and \(Y\) in place of \(a\) and \(X\). Finally, by the definition of covariance and the zero means of the standardized variables, $$ E[Z_XZ_Y] =\operatorname{Cov}(Z_X,Z_Y) =\frac{\operatorname{Cov}(X,Y)} {\sqrt{\operatorname{Var}(X)\operatorname{Var}(Y)}} =\operatorname{Corr}(X,Y). $$ Multiplying the two transformed standardized variables then gives \(E[Z_UZ_V]=\operatorname{sign}(ac)E[Z_XZ_Y]\), in agreement with the theorem.

Worked Example: Shifts and Positive Rescaling Leave Correlation Unchanged

Let \((X,Y)\) take the equally likely values \((-1,-2)\), \((-1,0)\), \((1,0)\), and \((1,2)\). Consider \(U=12+3X\) and \(V=-4+2Y\).

The means are \(E[X]=0\) and \(E[Y]=0\). The variances and covariance are $$ \operatorname{Var}(X)=\frac{1+1+1+1}{4}=1, \qquad \operatorname{Var}(Y)=\frac{4+0+0+4}{4}=2, $$ $$ \operatorname{Cov}(X,Y) =\frac{(-1)(-2)+(-1)(0)+(1)(0)+(1)(2)}{4} =1. $$ Thus \(\operatorname{Corr}(X,Y)=1/\sqrt{2}\).

Both slopes are positive: \(a=3\), \(c=2\), so \(ac>0\). The theorem predicts the same correlation. In fact, $$ \operatorname{Cov}(U,V)=6\operatorname{Cov}(X,Y)=6, \qquad \operatorname{Var}(U)=9, \qquad \operatorname{Var}(V)=8. $$ Therefore $$ \operatorname{Corr}(U,V) =\frac{6}{\sqrt{9\cdot 8}} =\frac{6}{6\sqrt{2}} =\frac{1}{\sqrt{2}}. $$ The nonzero shifts change the means, and the positive scale factors change the units and spreads, but neither changes the correlation.

Worked Example: Two Negative Slopes Preserve Correlation

Let \(X\) be uniform on \((-1,1)\), and set \(Y=-X\). Transform the variables to \(U=4-3X\) and \(V=2+5Y\). Find both the original and transformed correlations.

For a uniform variable on \((-1,1)\), symmetry gives \(E[X]=0\), and direct integration gives $$ \operatorname{Var}(X)=E[X^2] =\frac{1}{2}\int_{-1}^{1}x^2\,dx =\frac{1}{2}\left[\frac{x^3}{3}\right]_{-1}^{1} =\frac{1}{3}. $$ Since \(Y=-X\), \(E[Y]=0\), \(\operatorname{Var}(Y)=1/3\), and \(\operatorname{Cov}(X,Y)=E[-X^2]=-1/3\). Consequently, $$ \operatorname{Corr}(X,Y) =\frac{-1/3}{\sqrt{(1/3)(1/3)}}=-1. $$

The slopes are \(a=-3\) and \(c=5\), so \(ac=-15<0\). The transformation reverses the sign: $$ \operatorname{Corr}(U,V) =\operatorname{sign}(-15)(-1)=1. $$ The transformed variables both decrease as \(X\) increases: \(U=4-3X\) and \(V=2-5X\). Their perfect positive correlation agrees with the calculation.

Conditions, Interpretation, and a Common Pitfall

The requirement that both scale factors be nonzero is essential. If \(a=0\), then \(U=b\) is constant and \(\operatorname{Var}(U)=0\). The denominator in \(\operatorname{Corr}(U,V)\) is then zero, so that correlation is undefined—not zero. The same issue arises if \(c=0\). Likewise, correlation is undefined to begin with if either original variable has zero variance.

A common mistake is to argue that a negative scale cannot affect correlation because variances involve squared scale factors. That argument considers only the denominator. Covariance is multiplied by \(ac\), not by \(a^2c^2\). For example, if just \(X\) is replaced by \(-X\), then covariance changes sign while the standard deviations stay the same. The correlation therefore changes sign. If both variables are negated, the covariance is multiplied by \((-1)(-1)=1\), so the correlation is unchanged.

In applications, changing units by a positive factor and adding an offset—such as converting between common temperature scales—preserves correlation. Reversing a measurement’s coding direction, such as replacing a score by its negative, flips the sign if the other variable’s direction is unchanged. The numerical value still describes linear association, but its sign must be interpreted relative to the directions in which the variables are recorded.

Key takeaway: For \(U=aX+b\) and \(V=cY+d\), with nonzero slopes and well-defined original correlation, \(\operatorname{Corr}(U,V)=\operatorname{sign}(ac)\operatorname{Corr}(X,Y)\). Intercepts do not matter; the joint sign of the slopes does.

Check Your Understanding

Use the affine-transformation rule to answer each question. State when a correlation is undefined.

  1. If \(U=7+2X\) and \(V=-5+3Y\), how does \(\operatorname{Corr}(U,V)\) compare with \(\operatorname{Corr}(X,Y)\)?
  2. If \(U=4-X\) and \(V=Y+10\), what happens to the correlation’s sign?
  3. If \(U=-X\) and \(V=-Y\), is the correlation preserved or reversed? Explain using the product of the slopes.
  4. Why is correlation undefined if \(U=6\) with probability one, regardless of the distribution of \(V\)?
  5. Suppose \(\operatorname{Corr}(X,Y)=-0.4\), \(U=3X+1\), and \(V=-2Y\). Calculate \(\operatorname{Corr}(U,V)\).