I want to build a linear repeated measures mixed-effects model in R. I have a sample N=105 that completed measures at two timepoints (baseline and follow-up), and small group (N= 29) that received an intervention between baseline and follow-up. I want to know what variables (i.e. scores) are associated with viral load, overall, at both time points, besides the intervention. In other words, I want to control for the random effects of the intervention and time as I am not interested in these variables and investigate what other variables are associated with viral load, overall, across both timepoints. I want to do a mixed-effects model because it will be able to account for the fact that each participant did the measure twice.
The variables in the model are: Outcome variable: log viral load; Random effect variables: time (baseline and follow-up), groups_2 (intervention and no intervention), record_id (participant ID); Fixed effect variables: measure_score_1, measure_score_2, dem_age, dem_gender.
This is the model I want to build in R: model1 <- lmer(log_viral_load~ measure_score_1+ measure_score_2+ dem_gender+dem_age+ (1|groups_2/record_id), data= bothdata)
My question is: Are the specifications in model1 correct to answer the question? Specifically, do I need to incorporate the variable time as a random effect for it to account for the fact that each participant did each measure twice or if including record_id as a random effect does this?
Or do I need to include time as a random effect like this: model2 <- lmer(log_viral_load~ measure_score_1+ measure_score_2+ dem_gender+dem_age+ (1|groups_2/record_id)+ (1 |time), data= bothdata)
Thank you for your help.