Let's say we have a vector X = (1, 1, 1)
and Y = c(2, 2, 2)
. I want to calculate correlation between those. Taking Pearson correlation brings us nowhere, because standard deviation of both of these equals 0 so we divide by 0. It means that Pearson correlation suggests us that correlation is undefined. However let's use geometric approach which says that correlation coefficient can be calculated as :
So by substituting our two vectors we get :
$$r = \frac{1\cdot 2 + 1 \cdot 2 + 1 \cdot 2}{\sqrt{1^2+1^2+1^2}\cdot\sqrt{2^2+2^2+2^2}} = \frac{6}{\sqrt{3}\cdot \sqrt{12}} = \frac{6}{\sqrt{36}}=1$$
Why these approaches gives different results, while they are equivalent ? Which result is accurate ?