Correlation of two independent variables

241 Views Asked by At

Sorry if this is a basic queation, but I have some numbers and I'm asked to find the correlation between these two variables. My first variable (A) contains some values for a parameter which is measured by a human (let's say height of some objects). The second variable (B) contains some values collected by a device for the same set of objects. I simply calculated the absolute difference and percent different. But how define correlation here? My variables are independent right? Is there any r value for two independent variables? Example values:

A 2 4 5 7 10 18 37 B 3 4 3 7 16 20 35

Thanks

1

There are 1 best solutions below

4
On BEST ANSWER

The correlation is defined as $$ \frac{E(AB)-E(A)E(A)}{\sigma_A\sigma_B}$$ and the most common estimate of this quantity is the sample correlation $$ R = \frac{\sum_{i=1}^n (a_i-\bar a)(b_i-\bar b)}{\sqrt{\sum_{i=1}^n(a_i-\bar a)^2}\sqrt{\sum_{i=1}^n (b_i-\bar b)^2}}$$

where $\bar a$ is the sample mean $\bar a= \frac{1}{n}\sum_i a_i.$ So start by taking the average of the $a_i$ and $b_i$ and then plug it into this formula.

I will do a very simple example for reference. If you had $A =(1,2,3)$ and $B=(2,3,4)$ then $\bar a = 2$ and $\bar b = 3$ and $$\sum_i (a_i-\bar a)^2 = (1-2)^2+(2-2)^2+(3-2)^2 = 2.$$ Similarly, $\sum_i(b_i-\bar b)^2 = 2 $ and $ \sum_i(a_i-\bar a)(b_i-\bar b) = 2.$ So you have $$ R = \frac{2}{\sqrt{2}\sqrt{2}} = 1.$$ They are perfectly correlated. (You can see this because when you plot them against each other you get a straight line.)

The variables are hopefully not independent if your device and the human are any good at measuring heights. (And from eyeballing the example I think it's safe to say there's a significant correlation here.)