I am interested in learning whether a diet can help people lose weight. I randomly assigned  participants to receive the new diet. Weight was monitored at baseline  and again at the beginning of every month for 4 months following enrollment into the study.

I want to investigate if the new diet affect one’s weight over time differently for those on the new diet versus those not receiving the new diet.

I have the following data: id, treatment, age, outcome (the weight of a particular individual recorded at a given visit), and visitnumber.

I am not able to understand which model is appropriate for my question specifically, If I should include baseline age as a time varying variable (level 1 predictor) or as a covariate.

I have made the following model

adding adding visit number as level 1 predictor, treatment as level 2 predictor , visittreatment  interaction, and baseline age as covariate in random intercept (by id) and random  slope model (by visit). Yij=b00 +b01X+ b10 tij+b1 X1 * tij+r0i+ r1i* tij + b2age+ eij

b00 – average time 0 weight for Placebo group ( X= 0) b10 – average weight improvement for the placebo group for each visit ( X=0) b01 – average time 0 weight difference for treatment group patients b11 – average weight improvement difference for treatment patients for each visit r0i – individual deviation from average intercept r1i – individual deviation from average slope

  1. does this model look appropriate to my research question, or should I include age as level 2 predictor with treatment?
  2. I have age recorded as decimals ( for example 62.81341) as well as outcome recorded as (149.1255) will rounding them to 62 and 149.13 make any difference to my results?
  3. should I include interaction term age*treatment in my proposed model ?

1 Answer 1


You're almost there, I think. I'm not sure how baseline age is time varying though, and you don't need covariates for random intercepts or slopes - by definition they differ for each participant. Current age and visit may be correlated, so you might want to pick one over the other. Current age is often used if the time between visits is large (i.e., years) and variable across participants. If this isn't the case for your data, then visit is probably more appropriate. I would definitely include baseline age as a covariate if you're using visit.

Precision in age will matter on the variance. The lower the variance (in years), the more precision you will want.

The interaction should be included if you think the effect of the treatment changes over time (i.e., if it emerges over time).

  • $\begingroup$ hi ,just to be clear I have two variables one is visit and other is age at baseline.By including interaction do you mean to include visit x treatment or age x treatment? I have to include visit*treatment to answer my research question if the new diet affect one’s weight over time differently for those on the new diet versus those not receiving the new diet. However I do not know if include age as a covariate , do i include age x treatment in the model or it is not necessary $\endgroup$
    – 1234adhwa
    Commented Feb 5, 2023 at 0:12
  • $\begingroup$ This might be a little controversial, but my answer would be yes, and you should also include age x visit as well. See davidbaranger.com/2020/05/26/… $\endgroup$
    – David B
    Commented Feb 5, 2023 at 0:32
  • $\begingroup$ Thanks.do you think rounding the outcome and baseline age to one or two decimals would make any diffrence given my research question. Is there a rule of thumb to when to round outcome and covariate $\endgroup$
    – 1234adhwa
    Commented Feb 5, 2023 at 2:18
  • $\begingroup$ Is there any cost for being more precise? What's the down side? $\endgroup$
    – David B
    Commented Feb 5, 2023 at 2:35
  • $\begingroup$ I was thinking because I wanted to have sphagetti plots,few other plots,and table with distribution of outcome stratifed by treatment and time points ;it would make sense to round it to two or one demical places. As far as regression model I agree that more precision would be better to caputare the variance $\endgroup$
    – 1234adhwa
    Commented Feb 5, 2023 at 2:44

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.