If we normalize (scale and center) x
and y
, then the slope from y_norm ~ x_norm
is equal to cor(x, y)
. Why?
2 Answers
Because, by definition y_norm
and x_norm
are unit-variance random variables whose covariance is related to the covariance of $X$ and $Y$ by $$\operatorname{cov}\left(\frac{X-\mu_X}{\sigma_X},\frac{Y-\mu_Y}{\sigma_Y}\right) = \frac{\operatorname{cov}(X,Y)}{\sigma_X\sigma_Y}.$$
Now apply the definition of cor(x,y)
.
-
-
$\begingroup$ stats.stackexchange.com/questions/183778/… $\endgroup$– AlirezaCommented Oct 25, 2016 at 5:10
-
$\begingroup$ Not sure how to do a newline here! Anyways, I'm still not sure how the slope becomes equal to the correlation. And also the answers to the above post are not very clear. I came upon this problem when I was trying both
y_norm ~ x_norm
andx_norm ~ y_norm
, and to my surprise, the slope were the same. $\endgroup$– AlirezaCommented Oct 25, 2016 at 5:13 -
cor(x, y)=Cov(x,y)/Sd(x)sd(y) when you standardize.... your standard deviation of x and y will equal to 1 and therefore you will have 1 on your denominator and your cor(x,y) = cov(x,y)
-
$\begingroup$ I understand this, but my whole question is why cov(x, y) is the same as slope of y ~ x. $\endgroup$– AlirezaCommented Oct 28, 2016 at 22:07