I am applying a GLM model with binomial family:
glm(response ~ Treatment, family = binomial, data=dat)
The only explaratory variable treatment is a categorical variable. The model fit turns out that the residuals clearly do not have equal variances among the treatment levels (heteroscedasticy).
My question is 1) what I can do in this situation? A gam() is not meaningful for categorical variables. On the other hand, gls() is only applicable for linear model.
2) what if I have an extra random factor in the model (GLMM) and the residuals are still heterogeneous?
glmer(response~ Treatment + (1 | groupID), family = binomial, data=dat)
Is there any techniques or R packages can solve this?
This question is different from Regression modelling with unequal variance which asks similar situations with a linear model.