# Interaction Chi-Square in CBC

In CBC Counts Analysis the report shows the chi-square values of the interaction effects. For main effects it is no problem to calculate the chi-square value with pearson's formula. But I have no idea how to calculate the value for the interaction effects.

Imagine the following example: I have two attributes with three levels each. That means, I have  (3-1)*(3-1) = 4 degrees of freedom and 9 count values of two-way-occurances (combination of level_1 of attribute_1 with level_1 of attribute_2, ..., level_3 of attribute_1 with level_3 of attribute_2).

I do not know what to do with these 9 two-way-occurances to get the right chi-square value provided by the sawtooth software.

Dear Frank,

The chi-squared goodness of fit test compares the fit of a set of observed values O with a set of "expected" values E.  In this case the 9 count values you describe are the observed values and to run the test you need to figure out the expected values.

In a two-way table the expected value for a given cell is the row marginal (or total) times the column marginal divided by the total count.  So imagine your observed counts are like this

6 4 3
1 3 7
4 4 4

The expected value in row 1 column 1 would be the row total (13) times the column total (11) divided by the grand total (36) for a value of 3.9722.

You would repeat this calculation for each of the 9 cells and then run your Chi-squared test.

The logic here is that Chi-squared will be significant when there's enough divergence between the 0 values and the E values.

Does this make sense?
answered Jun 16, 2014 by Platinum (65,175 points)
Dear Keith, very nice, thank you very much! I was able to reproduce the chi-square values and have a deeper understanding of their meaning now.

Thanks a lot!