# chi square test vs logistic regression result

If I use both chi square test and logistic regression are the result will be the same in terms of P-value and numbers?

• Commented Apr 7, 2022 at 14:28

The $$\chi^2$$ test is equivalent to a Score test of nested logistic (or multinomial logistic) regression models: one containing only an intercept and the other containing a categorical predictor variable (with one feature dropped and subsumed by the intercept, the typical way of doing categorical variables in ANOVA). In that sense, the $$\chi^2$$ test is equivalent to logistic regression, yes.
Most software (by which I mean glm in R) gives Wald-based p-values by default, not Score-based. In that sense, I would regard the answer as no, logistic regression on a categorical variable is not the same as a $$\chi^2$$ test. If you just look at the values in the software printout, they are unlikely to be derived from the Score test, so they will not have the relationship to the $$\chi^2$$ test.
Logistic regression and Pearson's $$\chi^2$$ are only comparable under a very restrictive setting in which there is a single predictor and it is categorical, as well as assuming the outcome is a binary or unordered categorical response. So stick to that setting and consider the three types of test statistics arising from regression models using maximum likelihood estimation (such as the logistic model): Wald test (based on parameter estimates and their standard errors in simple cases), Rao efficient score tests, and likelihood ratio $$\chi^2$$ tests. The score test from binary or polytomous logistic regression models is identical to the Pearson $$\chi^2$$ test statistic.