I am running a logistic regression model in R using glm. I received a warning that complete separation occurred. How do I determine which variable is causing this? R doesn't tell you what variable is the issue.
The brglm2 package provides pre-fit and post-fit methods for the detection of separation and of infinite maximum likelihood estimates in binomial response generalized linear models - see the functions detect_separation() and check_infinite_estimates(), which are discussed at https://cran.r-project.org/web/packages/brglm2/vignettes/separation.html.
For an example of using the brglm package and eponymous function to address complete or quasi separation, see https://bscheng.com/2016/12/11/modeling-completely-separated-data-in-r/. This link on brglm may also help: http://www.wekaleamstudios.co.uk/posts/logistic-regression-and-bias-reduction/.