What is wrong with this chi squared test of independence?

I'm trying to learn how to run the chi squared test of independence. I've created two fictional variables, Variable 1 and Variable 2, and I want to know if they are correlated.

I'm working with the following values:

Variable 1  Variable 2  Row Total
Group 1     100         200         300
Group 2     150         300         450
Group 3     200         400         600
Group 4     250         500         750
Group 5     300         600         900
Col. Tot.   400         800         3000

Which gives me the following table:

Observed    Expected    (O – E) (O – E)^2   (O – E)^2/E
100         40          60       3600        90
150         60          90       8100        135
200         80          120      14400       180
250         100         150      22500       225
300         120         180      32400       270
200         80          120      14400       180
300         120         180      32400       270
400         160         240      57600       360
500         200         300      90000       450
600         240         360      129600      540

Which gives me a X^2 of 2700. So, according to this test, Variable 1 and Variable 2 are not correlated. I just don't see how this could be possibly be true. Am I running the test wrong, or is my interpretation of how the test should work incorrect?

• Which test of independence are you running? Can you post a link to the description? It doesn't look like the one I know. – Aksakal Apr 20 '14 at 14:39
• The example calculations make almost no sense: Your row totals are correct, but column totals should be 1000 and 2000. Thereafter expected = row total $\times$ column total/table total, so the first expected frequency should be 300 $\times$ 1000/3000 = 100, and so forth. A tell-tale sign of misunderstanding is the observed and expected frequencies don't have even roughly the same sum, as all the expected frequencies are less than the observed. – Nick Cox Apr 20 '14 at 14:57
• A conceptual misunderstanding here is that a chi-square test is not a test of correlation. It may be that you are confusing chi-square tests (in the flavour studied here, for frequencies of categories) with correlation calculations for two measured or counted variables. – Nick Cox Apr 20 '14 at 15:02
• @NickCox : you're right, I've messed up the column totals. I've used the test of independence described here: math.hws.edu/javamath/ryan/ChiSquare.html This page says that this test is used to test whether two variables are independent or related. I was under the impression that correlation is exactly that, but I might just be getting confused. – kormak Apr 20 '14 at 15:58

You have $\chi^2 = 2700$ (assuming you did the calculations correctly, I didn't check). You have df = 4. So, this will be very highly significant and thus be evidence that the variables are associated. Your mistake was at the end; either you figured out significance incorrectly or you misunderstood the test.