Lambdia

Slide It, Stretch It, and the Correlation Does Not Move

A shift leaves every deviation from the mean untouched, and a stretch multiplies the covariance and one standard deviation by the same factor, so both cancel out of the ratio. The tempting answer of five times rho is worse than wrong: at rho = 0.40 it names 2.0, which Cauchy-Schwarz forbids any correlation from reaching. The article carries the general affine rule, the sign flip a negative factor produces, and the curved maps the invariance does not survive.

Two variables have correlation ρ\rho. Add five to the first one. Then, instead, multiply the first one by five. What happens to the correlation each time?

Nothing, twice. Both operations leave it at ρ\rho exactly, and the second answer is the one people get wrong: 5ρ5\rho is the popular reply. It is not merely incorrect. For most values of ρ\rho it names a number no correlation can be.

The definition is a ratio, and that is the whole proof

Correlation

ρXY=cov(X,Y)/(σXσY)\rho_{XY} = \operatorname{cov}(X,Y) / \bigl(\sigma_X \sigma_Y\bigr), defined whenever both standard deviations are strictly positive. Everything below is a statement about what happens to the numerator and the denominator of that fraction, separately.

Both parts of the ratio are built out of deviations from the mean, and that is the only fact needed. Add a constant to XX and the mean moves by the same constant, so every deviation is untouched:

(X+5)E[X+5]=X+5E[X]5=XE[X](X + 5) - \mathbb{E}[X + 5] = X + 5 - \mathbb{E}[X] - 5 = X - \mathbb{E}[X]
(1)

The covariance is an average of products of deviations, so it does not move. Neither standard deviation moves. The fraction is the same fraction. A shift is invisible to a correlation, and this is why: the quantity was never looking at where the cloud sits, only at how it is shaped.

Stretching multiplies both sides of the fraction

Scaling is the interesting case, because something really does change. Multiply XX by 5 and the deviations multiply by 5, so:

cov(5X,Y)=5cov(X,Y),σ5X=5σX\operatorname{cov}(5X, Y) = 5\operatorname{cov}(X,Y), \qquad \sigma_{5X} = 5\,\sigma_X
(2)

The numerator grew by a factor of five and the denominator grew by exactly the same factor of five. Writing aa for the covariance and bb for the product of the two standard deviations, the entire content of the result is:

5a5b=ab\frac{5a}{5b} = \frac{a}{b}
(3)

Stating it that way is deliberate. The mechanism is a cancellation, and the cancellation has nothing to do with the number five or with the particular value of ρ\rho. Anyone who answers 5ρ5\rho has scaled the top of the fraction and forgotten the bottom.

Fig. 1 — The same cloud, moved and then stretched. The axis scales differ between panels and the score does not.

Why the wrong answer is worse than wrong

Take ρ=0.40\rho = 0.40, which is the figure in the picture above. The tempting answer is 5×0.40=2.05 \times 0.40 = 2.0. A correlation cannot be 2.0. It cannot exceed 1 for any pair of variables whatsoever, because the Cauchy-Schwarz inequality applied to the two centred variables gives:

cov(X,Y)σXσY1ρ1\bigl|\operatorname{cov}(X,Y)\bigr| \le \sigma_X \sigma_Y \quad\Longrightarrow\quad -1 \le \rho \le 1
(4)

So no multiplicative rule of the form ρcρ\rho \mapsto c\rho can exist for any c>1|c| > 1, because it would break the ceiling as soon as ρ>1/c|\rho| > 1/|c|. This is a stronger objection than pointing at the correct answer, and it is available before any algebra: a proposed rule that can leave the range of the quantity it computes is dead on arrival.

Fig. 2 — Five times 0.40 lands outside the only interval a correlation can occupy. The scaling rule is not off by a little, it is impossible.

The one factor that does change the answer

A negative multiplier is the exception, and it is the case the usual statement of this result forgets. The covariance takes the sign of the factor, since it is linear in each argument. The standard deviation takes its absolute value, since it comes out of a square root:

25(XE[X])2=5XE[X]\sqrt{25\,(X - \mathbb{E}[X])^2} = 5\,\bigl|X - \mathbb{E}[X]\bigr|
(5)

So the sign survives on top and not underneath, and ρ\rho flips. Putting all of it together gives the general rule for affine maps applied to each variable separately:

corr(aX+b,  cY+d)=sgn(ac)corr(X,Y)\operatorname{corr}(aX + b,\; cY + d) = \operatorname{sgn}(ac)\,\operatorname{corr}(X, Y)
(6)

Magnitude untouched, sign given by whether the two stretches point the same way. On the cloud in Fig. 1, multiplying XX by 5-5 takes the score to exactly 0.40-0.40 and nowhere else.

What a correlation is not invariant under

Equation (6) is a complete description of the invariance, and reading it carefully tells you where it stops. The maps have to be affine, and they have to act on each variable on its own. A monotone but curved map is not covered, and it genuinely moves the number. Taking logarithms of the horizontal coordinate of the cloud in Fig. 1, after shifting it positive, moves the score from 0.4012 to 0.3944. Small here, and not small in general: correlation measures linear association, and a nonlinear change of variable changes what counts as linear.

If you want a coefficient that survives every increasing map, you have to give up on covariance and use the ranks instead, which is what Spearman's coefficient does. It is invariant under any strictly increasing transformation of either variable, and the price is that it no longer answers the question the covariance was answering.

One more thing equation (6) covers without comment: it holds for the sample coefficient computed from data as well as for the population one. The nn or n1n-1 in the sample covariance appears identically in both sample standard deviations, so it cancels along with everything else. That is why the check on the twenty-six points above returns a bit-identical number rather than a close one, and why an exact-arithmetic test is the right test for a claim of this kind.

Two degenerate cases are worth naming. If either variable is constant, its standard deviation is zero and the ratio in the definition is undefined, so there is no correlation to preserve. And multiplying by zero produces exactly that situation, which is the boundary case equation (6) excludes through sgn(0)=0\operatorname{sgn}(0) = 0 being the wrong kind of answer: the correlation is not zero there, it does not exist.

Sources and further reading

Because this is an identity rather than a limit, the primary check was exact: a five-point dataset in rational arithmetic gives a bit-for-bit identical squared correlation under the shift, the positive stretch, both together, and a stretch of the other variable, with the sign tracked separately and negated under a factor of 5-5. A two-hundred-thousand-point sample at three target values agreed to within 101210^{-12}, which is the signature an exact invariance should leave, and a four-hundred-way sweep over five transformations never produced a value outside the band in Fig. 2.

Comentarios · 0

Sé el primero en comentar.