Bivariate Regression when X and Y are both binary (/categorical) Hello I wanted to know whether logistic regression can be used if X and Y are both binary. I am aware that the sole condition for logistic regression is that Y is binary, however Im not sure how to interpret it if X is binary?
Also do you think this is a good strategy? Or is Chi square to be preferred in such cases.
What could be other alternatives.
 A: Chi-square is perfectly acceptable for data like this. However, there are added benefits to logistic regression.
Where as chi-square asks "is there difference between groups?" logistic regression asks "what is the difference between groups".  You also get confidence intervals for both proportions and the difference in those proportions (albeit on the log odds scale, but there are ways around this).
Logistic regression offers a much richer set of inferences in my opinion.
A: TOTALLY FINE
Anything you can do with the features (the $X$) of a linear model, you can do with the features of a generalized linear model like a logistic regression. That’s part of the beauty of generalized linear models: just apply a link function $g$ and, at least in some sense, treat the problem like a linear model.
$$
g\left(\mathbb E\left[Y\vert X\right]\right)=X\beta
$$
However, this is equivalent to calculating the proportions for each of the two $X$ groups. When it comes to confidence intervals, life gets harder, since the usual methods for calculating the confidence interval for a difference between two proportions do not obviously drop out of the logistic regression parameter confidence intervals. Ditto for hypothesis testing.
