# The results of logistic regression with glmer and glm are quite different

I'm trying to analyze the longitudinal data of clinical trial.

The variables are

event: Dichotomous (1, 0) variable indicating whether event occured.

treat: Dichotomous (1, 0) variable indicating whether patients were assigned to treatment group or control group.

time: The time point indicating when the patients were observed. We observed the patient at 1week, 1month, 3months from baseline.

id: The id of individual patient

For example, the data of patient1 is constructed as follows

id time treat event
patient1 1week 1 0
patient1 1month 1 1
patient1 3months 1 0


I analyze the model with generalized linear-mixed effect model using glmer function. Also, I analyzed it with glm function. Both model use binomial distribution with logit link. To analyzed the difference in change according to time from baseline, the model includes interaction term.

model1<-glmer(event~time+treat+time:treat+(1|id), data, family="binomial",
control=glmerControl(optimizer="bobyqa",optCtrl=list(maxfun=2e5)),nAGQ = 10)

model2<-glm(event~time+treat+time:treat, data, family="binomial")


However, both model outputs very different results. For example, the coefficient of treat*3months in model1 was 1.25, and in the model2, it was 0.81. When exponentiated, the odds ratio became 3.5 and 2.2.

What's even stranger is, when I fitted both model with poisson distribution, the results are identical (0.51).

How this happened? I would really appreciate for all your help.

• While waiting help, I found some hints for the mismatch. 1) First, the output of GLM is 'marginal effect' and GLMM is 'subject-specific effect'. Those effects are different, especially in non-linear outcome 2) The non-collapsibility is also an issue. Following link handles this problem thestatsgeek.com/2017/05/11/… Jun 24, 2021 at 8:40
• I found the answer. It is explained well in following text. quantscience.rbind.io/2020/12/28/… Nov 26, 2021 at 1:58