Solved – Logistic regression with only categorical predictors

binomial distributiongeneralized linear modellogisticmultiple regressionregression

So I started off with a model which included both continuous and categorical predictor variables. But now I wanted to drop the only continuous variable (distance to shore), because to my opinion it was too much correlated with other variables (habitattype). So that leaves me with only categorical predictors and there interaction terms in the model, but is that actually allowed for binomial regression?

If so, what is a good way to visualize the results? The predicted values over a predictor (categorical) is going to give strange graphs because of the limited categories.

Best Answer

Yeah, it's perfectly acceptable for a logistic regression to contain only categorical predictors. Remember that we code categorical predictors numerically (e.g., 0 and 1, -1 and 1, etc.), so the distinction between categorical and continuous doesn't really exist for the regression.

As for how to plot the effect, I would typically use a bar plot with each bar representing the estimated probability of observing a specific outcome in that condition. These estimates can be calculated using the coefficients of the model. Remember that while a logistic regression produces estimates in logit space, with an inverse logit transformation you can turn predicted values into probabilities.

The below graph actually plots the proportions (so what was observed in the data that was subsequently analysed with a logistic regression, rather than what was estimated by the regression), but it should convey the general idea.

enter image description here