# Logistic regression vs chi-square in a 2x2 and Ix2 (single factor - binary response) contingency tables?

I'm trying to understand the use of logistic regression in 2x2 and Ix2 contingency tables. For instance, using this as an example

What is the difference between using chi-square test and using logistic regression? What about a table with multiple nominal factors (Ix2 table) like this:

There is a similar question here - but the answer is mainly that chi-square can handle mxn tables, but my question is what is specificalyl for when there is a binary outcome and a single nominal factor. (The linked thread also refers to this thread, but this is regarding mutiple variables/factors).

If it's just a single factor (i.e. no need to control for other variables) with a binary response, what is the purpose difference of doing logistic regression?

• +1 for the question, but you need to facilitate copying and pasting data to work with it. Commented Oct 20, 2015 at 15:02
• See Why do my p-values differ between logistic regression output, chi-squared test, and the confidence interval for the OR?. Pearson's chi-squared test for association is just the score test for the null hypothesis that all the slopes are zero. The corresponding likelihood ratio test is asymptotically equivalent. As @Kodiologist says, the uses to which logistic regression might be put are broader than testing that all slopes are zero. Commented Oct 20, 2015 at 16:25

Ultimately, it's apples and oranges.

Logistic regression is a way to model a nominal variable as a probabilistic outcome of one or more other variables. Fitting a logistic-regression model might be followed up with testing whether the model coefficients are significantly different from 0, computing confidence intervals for the coefficients, or examining how well the model can predict new observations.

The χ² test of independence is a specific significance test that tests the null hypothesis that two nominal variables are independent.

Whether you should use logistic regression or a χ² test depends on the question you want to answer. For example, a χ² test could check whether it is unreasonable to believe that a person's registered political party is independent of their race, whereas logistic regression could compute the probability that a person with a given race, age, and gender belongs to each political party.

• Thanks. Would you be able to give me an example of the different type of questions you can answer with the different methods? Are there any specific resources you can recommend for understanding the different questions that can be answered with the two methods? Commented Oct 21, 2015 at 20:52
• I added examples to my answer. Regarding your second question, Wikipedia is a decent place to begin. Also, most introductory applied statistics textbooks will mention both the χ² test of independence and logistic regression. Commented Oct 21, 2015 at 22:03
• Thanks. I'm still unclear of what the difference is in the specific case of a 2x2 contignency table? chi square would check if the outcome is independent of the variations of the factor, but what does logistic regression do here? I understand LR is useful for doing predictions based on a series of factors, but when it comes to the simple 2x2 I'm not sure what the difference is (but it's clearly used)...could you (or anyone) use the 2x2 stress/reflux table in the original post as a concrete example of how they would be used differently? It's the single factor case that I'm most interested in Commented Oct 22, 2015 at 1:46
• or the race/political party works just as well as an example, but when you then use logistic regression you are using multiple factors, and I can see how it is useful there...but what I specifically have a hard time understanding is why use LR (or how is it different) in the single factor case. If both methods are used to examine relationship between race and political party, what's the difference between chi square and logistic regression? Commented Oct 22, 2015 at 1:50
• In the case of the stress and reflux example, you could use logistic regression to test whether stress significantly affects the probability of reflux, or you could compute a confidence interval for the odds ratio expressing this effect. One way in which this is conceptually different from a χ² test is that one of stress or reflux is construed as the dependent variable. But in any case, logistic regression may be considered overkill for a 2-by-2 contingency table. Commented Oct 22, 2015 at 12:10