Notation for specifying nested random effects using LME

8 views (last 30 days)
Greetings,
I have the following dataset. Patients were recruited from 4 hospital sites to be randomized to either an active or placebo treatment. Clinical scores were collected at baseline, week 2, weeek 4, week 6 and week 8. Baseline biological data was also collected. My ultimate goal is to see if the biological data collected at baseline predicts treatment trajecetories and if this differs between active and placebo treatment arms.
From my understanding, it would be best to model this using LME. However, there is a nesting structure in my data due to patients being recruited from 4 sites.
I ultimately want to know how can I specify, using LME, subjectID and site to be random effects, with subjectID nested in site.
I have come up with the following, but am quite sure it is wrong:
ClinicalScore ~ ClinicalScore_wk0 + Age + Sex + TreatmentGroup*BioData*Time + (subjectID | Site)
Any help would be greatly appreciated.
Thank you.

Answers (1)

Vatsal
Vatsal on 29 Dec 2023
Hi,
I understand that you want to specify a nested random effects structure in your linear mixed-effects model (LME). Given that "subjectID" is nested within "Site", this relationship can be accurately captured in the random effects section of the model formula.
The model formula would look something like this:
ClinicalScore ~ ClinicalScore_wk0 + Age + Sex + TreatmentGroup*BioData*Time + (1|Site) + (1|Site:subjectID)
You can also refer to the below link for the additional information:
I hope this helps!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!