zhouhj1994 / LinDA

33 stars 3 forks source link

what is (1|SubjectID) in linda() function argument "formula = '~Smoke+Sex+(1|SubjectID)'" #10

Open zhq90 opened 1 year ago

zhq90 commented 1 year ago

In linda() function, what is (1|SubjectID) for? Is it the random variables to be corrected?

zhouhj1994 commented 12 months ago

If each subject has two or multiple samples (e.g., pre and post treatment), then these samples have a common SubjectID, and are not independent. So we need to treat SubjectID as a random effect and include it in the regression formula ( (1|SubjectID)). Here 1 in (1|SubjectID) means that we do not consider the interaction between SubjectID and some other variable.

zhq90 commented 10 months ago

If I want to corrected the effect of other variables (like gender, Age......) on the result, should I use "formula = '~Smoke+Gender + Age", or "formula = '~Smoke+(1|Gender) + (1|Age)"?

zhouhj1994 commented 10 months ago

Use '~Smoke+Gender + Age" as Gender and Age are fixed effects not random effects.