Skip to main content
1 of 5
statmerkur
  • 6.7k
  • 1
  • 21
  • 48

Expanding on @gung's excellent answer:

In a simple linear regression Pearson's $r$ can be seen as the geometric mean of the two slopes we obtain if we regress $y$ on $x$ and $x$ on $y$, respectively: $$\sqrt{\hat\beta_{y\,on\,x} \cdot \hat\beta_{x\,on\,y}} = \sqrt{\frac{\text{Cov}(x,y)}{\text{Var}(x)} \cdot \frac{\text{Cov}(y,x)}{\text{Var}(y)}} = \frac{\text{Cov}(x,y)}{\text{SD}(x) \cdot \text{SD}(y)} = r $$ Circumventing problems with the square root of possibly negative slope coefficients, we can obtain $r$ directly using $$ r = sign(\hat\beta_{y\,on\,x})\cdot sign(\hat\beta_{x\,on\,y}) \cdot \sqrt{|\hat\beta_{y\,on\,x}| \cdot |\hat\beta_{x\,on\,y}}| $$

statmerkur
  • 6.7k
  • 1
  • 21
  • 48