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.

  • $\begingroup$ 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/… $\endgroup$
    – ESKim
    Jun 24, 2021 at 8:40
  • $\begingroup$ I found the answer. It is explained well in following text. quantscience.rbind.io/2020/12/28/… $\endgroup$
    – ESKim
    Nov 26, 2021 at 1:58

1 Answer 1


The glmer() model includes a random intercept for id, and the glm() model does not. The random intercept eliminates some variance between subjects to account for the nested nature of your data. If you have repeated measures nested in id, the preferred model is likely glmer().

I don't have an answer for why the Poisson model was the same, but it doesn't seem like Poisson is an appropriate model for your dependent variable. It could be related to this misspecification.


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.