# Chi-Square test for categorical variables

How can we use Chi-Square test for categorical variables? For example, when we have {True,False} values for the variable under test.

Is Chi-Square test suitable in this case? is there any other alternatives?

Here is an example of my data. I have two adjacency matrices {observed, expected} for the same nodes, there is "1" if there is an edge between two nodes (i,j) and "0" otherwise. I want to apply Chi-Square test for these two matrices.

• I am not sure what you are asking. Do you mean you want to tell if the proportion saying "true" is the same as that saying "false"? Or something else? Probably chi-square is right, but please clarify so we can be sure. – Peter Flom Feb 10 '14 at 15:39
• There is not enough information here. Are there more variables than just a count of Trues & Falses? What is the nature of your data & your study? What are your goals here? – gung Feb 10 '14 at 15:39
• I want to test the correlation between these two matrices. I've updated the question. – M.M Feb 10 '14 at 15:52
• I still don't know enough here. How many nodes do you have? Where did the "expected" matrix come from? Do you want to assess the goodness of fit of your observed matrix to an expected pattern that comes from something else? Can you paste the matrix into your question? – gung Feb 10 '14 at 15:54
• I can't advise easily; I can't see an interesting statistical hypothesis implicit in your question. You could reduce your matrices to a $2\times2$ table: 0 or 1 in $A$ versus 0 or 1 in $B$ but that sounds a lousy way to compare $A$ and $B$ as virtually all the information is discarded. – Nick Cox Feb 10 '14 at 16:15