# Value of r, i.e. correlation coefficient, of data points on a horizontal straight line

1. If we use the formula: $$r = \displaystyle \frac{\displaystyle\sum_{i=1}^n \left( x_i - \bar{x} \right) \left( y_i - \bar{y} \right)}{\sqrt\sum_{i=1}^n \left( x_i - \bar{x}\right)^2 \cdot \sum_{i=1}^n \left( y_i - \bar{y}\right)^2}$$ for calculating $r$, we get $r = \frac{0}{0}$.
2. If we see $r$ as a measurement of the strength and nature of the linear relationship between two variables, we get $r = 0$ because there is no linear relationship in this case.
3. If a perfect positive fit gives $r = 1$, and a perfect negative fit gives $r = -1$, then it seems like we should get $r = 1$ or $-1$. (I think this is wrong though.)

Which is correct? From the definition below:

$r = \displaystyle \frac{\displaystyle\sum_{i=1}^n \left( x_i - \bar{x} \right) \left( y_i - \bar{y} \right)}{\sqrt\sum_{i=1}^n \left( x_i - \bar{x}\right)^2 \cdot \sum_{i=1}^n \left( y_i - \bar{y}\right)^2}$, or equally $r = \displaystyle \frac{1}{n-1} \sum_{i=1}^n \left( \frac{x_i - \bar{x}}{s_x}\right) \left( \frac{y_i - \bar{y}}{s_y}\right)$

You get answer one which seems correct to me since you have identical values of $y$ independently of the different $x_i$. And since $y_i = \bar{y}$ for all $i$, you get $0$'s in column ${\tt K}$ of your table and end up with $r = \frac{0}{0}$.

Answer two is discarded because $s_y = \displaystyle \sqrt{\frac{1}{n-1}\sum_{i=1}^n \left(y_i - \bar{y}\right)^2}=0$ as well.

You would get answer three if the variations $\Delta x_i$ and $\Delta y_i$ were at least directly or indirectly proportional. Which isn't the case here. So, $r > 0$ and $r < 0$ are discarded too.

You will still get the same answer one, $r = \frac{0}{0}$ if you switch $x$ and $y$ values. You might want to check this question on correlation coefficients on random variables. The answers and comments are great.

• Hi, @Gilles. I marked your answer as useful. Can't really accept your answer as it was the comments in this other question you pointed me to (stats.stackexchange.com/questions/46410/…) that cleared my doubts. Hope you don't mind. – Neo Jul 28 '14 at 9:12