# Chi-squared goodness-of-fit test and conditional probability distribution

I have three discrete variables, let's say $A, B,$ and $C$. The number of possible values of $A$ is 3, and $B$ and $C$ take binary values. I also know the probability distributions, $Pr(A | B, C)$, $Pr(B)$ and $Pr(C)$. I need to check if a given sample is consistent with these distributions. So, I perform Chi-squared goodness-of-fit test to check if values of $B$ and $C$ in the sample are consistent with $Pr(B)$ and $Pr(C)$ respectively. But how can I perform this test for $A$?

Edit: In response to Adam's comment, I have the following distributions:

|           Pr(A|B,C)
A   | b1,c1 | b1,c2 | b2,c1 | b2,c2
----+-------+-------+-------+------
a1  | 0.3   | 0.6   | 0.7   | 0.2
a2  | 0.5   | 0.1   | 0.05  | 0.3
a3  | 0.2   | 0.3   | 0.25  | 0.5

Pr(B)
---------
b1  0.4
b2  0.6

Pr(C)
---------
c1  0.8
c2  0.2

In my sample, I have the following:

A   B   C   Count
-----------------
a1  b1  c1  100
a1  b1  c2  50
a1  b2  c1  250
a1  b2  c2  250
a2  b1  c1  95
a2  b1  c2  105
a2  b2  c1  70
a2  b2  c2  30

B   Count
---------
b1  350
b2  600

C   Count
---------
c1  515
c2  435
• Could you post these distributions? – Adam Przedniczek May 24 '16 at 21:44
• +1 It's an interesting question, despite obvious inconsistency between the data you posted and the assumed distribution for $C$. – whuber May 24 '16 at 22:40
• Yes @whuber, in this sample, it is clear, even without any calculation, that the sample is not consistent with the assumed distribution but what if my assumed distribution for $C$ was $Pr(C=c1)=0.55$? – user1219801 May 24 '16 at 22:49
• @user1219801 Leave the distribution for C as is. Maybe in your problem statement is something about independence of A, B & C? In such case that would be trivial. The expected count for e.g. $A=a_1$ would be $N \sum\limits_{b_x, c_x} Pr(A=a_1 | B = b_x, C = c_x) \cdot Pr(B=b_x) \cdot Pr(C =c_x)$ where $N=950$. With this assumption everything is so simple. The only question remains what would be the number of degrees of freedom for such statistic (my only guess 3). Maybe you have omitted something in this question? – Adam Przedniczek May 25 '16 at 10:31
• @Adam Certain subtleties suggest this question might not be as simple as it appears. One concerns the degrees of freedom to use. Another is that when you conduct multiple tests on the same data, you have to be concerned about whether they are independent. You might also need to think about controlling the false positive rate for the multiple tests being performed. I believe it is straightforward to address all these points, but they shouldn't be overlooked. – whuber May 25 '16 at 13:20