I have a question on subject chi-square test for independence.

I have, for example, two events A and B. If chi square test is not passed: is A dependent on B (A|B) or B on A (B|A)? Or does be valid both? (A|B and B|A).

Thank you in advance.


There's nothing wrong with the existing answers, but I suspect that you're looking for a causal sense of dependence rather than an associational one, that is: whether A causes B rather than whether B is more predictable when you know A. The chi^2 test is working with the second sense.

Even in the simplest case of the first kind of dependence you would ideally experimentally manipulate B and observe the effect on A and vice versa. Judea Pearl points out that this is the difference between the ordinary sense of conditional probability

P("I observe that A has value a" | "I observe that B has value b")

and a quite different thing that we might slightly misleadingly write as

P("I observe that A has value a" | "I fix B to have value b")

These need not, of course, be the same number.

  • 1
    $\begingroup$ +1 for the creative (and insightful) interpretation and explaining the distinction. $\endgroup$ – whuber Oct 30 '10 at 15:11

I assume A and B are both random variables taking discrete values and you are thinking of a chi-squared test on the two-way frequency table formed by the counts of observations on the two variables.

In that case, a significant result indicates both directions of dependence: A|B and B|A.

If you think about Bayes' theorem, it is clear that one always implies the other:

P(A|B) = P(B|A) P(A) / P(B)

So P(A|B) = P(A) if and only if P(B|A)=P(B).

  • $\begingroup$ You don't need assumption about 2x2 table but rather kxm table. $\endgroup$ – Wojtek Aug 13 '10 at 6:06
  • $\begingroup$ Of course. Now fixed. $\endgroup$ – Rob Hyndman Aug 13 '10 at 6:32

There are two definitions of statistical independence: 1) P(A,B)=P(A)*P(B) <=> 2) P(A|B)=P(A) <=> 2a) P(B|A)=P(B).

(<=> means if and only if)

So to answer your question: both are valid.

Pearson Chi-square test of independence is motivated by definition 1), logistic regression and multinomial regression are motivated by definition 2) of independence.


A chi-square test is not motivated by your description thus far. Give many more details.

Chi-square tests for independence are used to see if the probability or counts of each kind of event in a given variable are independent of other variables.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy