What is the purpose of doing a logistic regression when the predictor is dichotomous?

I would like to expand on this question. Knowing that it is possible to do a logistic regression when the IV is dichotomous, and that I've seen it done in studies: what is the purpose of doing so, and what would be the advantages over using the usual Pearson X-square or (if a non-categorical version of the predictor is available) a simple t-test?

• How could you use the t test when both variables are dichotomous? Dec 11 '18 at 15:15
• For instance if the predictor was made dichotomous by binning, one could go back to an ordinal variable (e.g. grade instead of pass/fail) and perform a t-test. Dec 11 '18 at 16:39
• "what is the purpose of doing so?" Showoff. "what would be the advantages over using the usual Pearson X-square?" No. Dec 12 '18 at 3:19

In terms of fit to the data, any GLM will give equivalent fit in a binary-binary situation. So if you do the regression and check the predicted probabilities, they'll all be the same regardless of which GLM or link function you use. See page 175 of Wacholder (1986) below.

Pearson $$\chi^2$$ test (without continuity correction) will be equivalent to Rao's score test of the logistic regression model, so they are practically equivalent. And the G test is equivalent to the likelihood ratio rest from the logistic regression. The default test in most packages is a Wald test.

A linear regression or t-test may be faulty because binary data implies heteroskedasticity on the scale of the binary response. So Welch's t-test might actually be acceptable for inference.

The t-test will give the simplest interpretation. The mean difference is the difference in probabilities between the two groups.

UPDATE

As @AdamO pointed out in the comments, you can also do a GLM with binomial distribution and identity link function. Sometimes, this model will not converge in software but it definitely will when the lone predictor is dichotomous. This has the advantage of estimating the correct mean difference with an adequate variance structure. If you perform the score test, the inference will again be no different from logistic regression.

SHOLOM WACHOLDER; BINOMIAL REGRESSION IN GLIM: ESTIMATING RISK RATIOS AND RISK DIFFERENCES, American Journal of Epidemiology, Volume 123, Issue 1, 1 January 1986, Pages 174–184, https://doi.org/10.1093/oxfordjournals.aje.a114212

• +1 very nice answer. I thought the Pearson Chi-sq test was the score test for the logistic likelihood, though. If the OP wants a test of the proportion difference, another approach worth considering is using a GLM with binomial variance structure and identity link. This is an "additive risk" model (or whatever the nature of the outcome is). Dec 12 '18 at 16:35
• @AdamO I agree, binomial distribution with identity (and log) link is the actual recommendation in Wacholder's paper. Pearson Chi-sq test for two-by-two contingency tables is the score test for the binomial likelihood. Dec 14 '18 at 18:34