I wish to check the invariance property of correlation. As described in this wiki section Wiki - Mathematical Properties of Correlation. A quote from the Wiki page I wish to test is below.

That is, we may transform X to a + bX and transform Y to c + dY, where a, b, c, and d are constants with b, d > 0, without changing the correlation coefficient.

Correlation[{a + b *x1, a + b*x2}, {c + d*y1,c+ d* y2}] ==Correlation[{x1, x2}, {y1, y2}]
Refine[%, {{a, b,c, d, x1, x2, y1, y2} \[Element] Reals, {b, d} > 0}] 

From the output, I believe I can see that these are in fact equal if I factor and cancel b and d. However, I would have hoped that Mathematica would have simply returned the result "True".

Why did Mathematica not return "True"?


1 Answer 1

Correlation[{a + b x1, a + b x2}, {c + d y1, c + d y2}]==Correlation[{x1, x2}, {y1, y2}]

FullSimplify gives the expected result:

Assuming[Variables[%] ∈ Reals && And @@ Thread[{b, d} > 0], FullSimplify @ %]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.