# How to tell which variable is perfectly separated in R [duplicate]

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.

• There might not be any single variable that, by itself, causes the problem. How you approach this question therefore might depend on how many variables are involved in the model: with just a few variables you can explore all subsets of them; but with more you would need a better approach. – whuber May 25 '18 at 19:08
• There are 10 variables in the model. I've been debating using the logistf package to perform a penalized version of logistic regression. – BenW May 25 '18 at 19:12
• $10$ is small enough that--provided you don't have a huge number of observations--you could simply loop through all nonempty subsets of the variables to see which combinations create perfect separation and which do not. Focusing on just the larger subsets might be good enough to characterize what's going on. – whuber May 25 '18 at 22:52
• There is no reason to close this. It's not about R, it's about statistics. – Peter Flom May 26 '18 at 13:18