We have collected data from n patients, with each patient having one eye treated and the other untreated.

We would like to see if the treated eye progresses differently to the untreated eye using biomarkers measured from each eye.

Currently, I am using the model:

lmer(biomarker_change ~ days + treated_yn + (1 | patient_id), data = study)

using the lme4 package. Is the random effect (1 | patient_id) enough here? I feel like since the eyes are from the same patient, something is a bit strange/ missing here.

Also, I'm using biomarker change as opposed to raw marker values to allow for differing starting points.

  • $\begingroup$ looks quite OK to me at first glance $\endgroup$ Commented Sep 6, 2023 at 12:42
  • $\begingroup$ @PatrickCoulombe ok, thanks. It seems ok to me too, just that there will be a biological effect being the same patient involved which is hard to control for. $\endgroup$
    – JP1
    Commented Sep 6, 2023 at 12:45

2 Answers 2


A couple of points:

  • You do not need to work with differences from baseline because the random intercepts term accounts for these differences.
  • Using only random intercepts means that the correlations between the biomarker measurements over time are constant. Most often, this is not realistic. You could try also including random slopes, i.e., lmer(... + (days | patient_id)) and compare the two models using a likelihood ratio test implemented by the anova() function.
  • Measurements from the same eye will probably be more strongly correlated than measurements from different eyes on the same patient. You could test that by including the nested random effect, i.e., lmer(... + (1 | eye_id)).

I think you need to nest the eyes within each subject ID, so

lmer(biomarker_change ~ days + treated_yn + (1 | patient_id/eye), data = study)

As you have already questioned, your original model was incomplete by not accounting for the random variation from the two eyes from the same patient. The (1 | patient_id/eye) term is equivalent to (1 | patient_id) + (1 | patient_id:eye) where the : denotes the interaction between each patient's right and left eyes.

See Nested Data - Mixed Linear Effects in R Assumptions

And Have I correctly specified my model in lmer?


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.