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). enter image description here

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.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.