Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Linear mixed models with repeated measures outcomes and time-varying covariates

    Hello Stata Forum,
    Your responses have been very useful.
    I am looking for help that I have not able to find addressed here in the forum previously.
    I am using Stata version 14.2
    My research question is looking at the consumption of a food group on body weight.
    • Exposure: food group intake measured at baseline, year 1 and year 2
    • Outcome: Body weight was also measured at baseline, year 1 and year 2
    I am doing this as a secondary analysis using a database of a mulit-centred RCT, where some participants (couples) were randomized together (indicated by a cluster variable, idcluster).
    So for the levels, I certainly do have the centres at the highest level and the patients at the lowest.


    I am trying to better understand and apply the linear mixed models with repeated measures outcomes and time-varying covariates

    I am looking for help to think through 3 points:
    1. Which of the following syntaxes seems more appropriate?
    • Option1: mixed body_weight_t food_exposure_t i.visit c.food_exposure_t #i.visit fixed factors ……… || centre || idcluster: || paciente: ; I believe this only accounts for the multiple levels in random factors
    • Option2 : mixed body_weight_t food_exposure_t i.visit c.food_exposure_t #i.visit fixed factors || centre || idcluster: || paciente: visit, covariance(unstruct) ;- I believe that this accounts for individual slopes as a random term and is a better option
    1. Should idcluster in this case, be treated as a random effect or is it more like a fixed effect? Because a cluster at the max has only 2 individuals. The dataset has approximately 7000 participants, Hence a lot of idclusters.
    1. Can vce be used with linear mixed models? In that case can we use the id as a cluster variable.?
    Thanks in advance.
    Last edited by Shyam Srini; 10 Jan 2024, 11:24. Reason: edited for clarity

  • #2
    can someone help please?

    Comment


    • #3
      Dear all,

      I understood that we cannot use the visit as a categorical variable in the fixed term and use it as continuous in the random equation part of the syntax. We have upgraded to state 18 and now I can use visit as i.vist in both


      mixed BMI_v0 i.T_ajust_eggs_v0 i.visit i.visit#i.i.T_ajust_eggs_v0 i.sexo_s1 c.edad_s1 i.grupo_int_v00 i.nodo smoke_status_v00 civil_status_v00 BMI_b edu_level_v00 diab_prev_s1 /// fixed factor (fixed covariates)
      c.PAL_v0 c.alcoholg_v0#c.alcoholg_v0 porc_hc_v0 p17_total_v0 ||nodo: || idcluster: || paciente:
      estimates store A
      estat icc
      estat ic
      margins i.visit#i.T_ajust_espagueti_v0, plot
      contrast [email protected]_ajust_espagueti_v0, effect
      contrast i.visit#i.T_ajust_espagueti_v0, effect
      Question 1: is this syntax correct?
      Ouestion2: I am wondering if including a random slope at the level of the paciente is important too?

      mixed BMI_v0 i.T_ajust_eggs_v0 i.visit i.visit#i.T_ajust_eggs_v0 i.sexo_s1 c.edad_s1 i.grupo_int_v00 i.nodo smoke_status_v00 civil_status_v00 BMI_b edu_level_v00 diab_prev_s1 /// fixed factor (fixed covariates)
      c.PAL_v0 c.alcoholg_v0#c.alcoholg_v0# porc_hc_v0 p17_total_v0 ||nodo: || idcluster: || paciente: i.visit
      estimates store B
      Question3: Is there any statistical test to decide whether to use a particular covariance structure?

      Thanks again

      Comment


      • #4
        It is hard to answer your questions because I do not I understand how your research question maps onto your data. Based on your magins syntax, you are focused on the interaction between the categorical visit variable and T_ajust_espagueti_v0, however, there is not an interaction between those two variables in your mixed model. Instead I see i.visit#i.i.T_ajust_eggs_v0 but T_ajust_espagueti_v0 is not found in the model at all. If your interest is in what you have in the margins syntax, then you need to include that in the mixed syntax as well.

        Including a random slope in this case means that the association between visit and the outcome is allowed to vary across patients. Any interaction between visit and other variables is akin to explaining such slope heterogeneity. Here you are saying that the assignment to treatment (or whatever T_ajust_eggs_v0 represents) can explain varying effects of visit on the outcome. Said differently, but nonetheless statistically equivalent, is that you are testing whether the effect of T_ajust_eggs_v0 varies based on the visit.

        In terms of a statistical test of whether the first or second model are a better fit to the data, you can use the likelihood ratio test (
        lrtest in Stata) for this. Search for the section titled, "Distribution theory for likelihood ratio test" in the multilevel mixed effects reference manual documentation for more information on how to interpret this test.

        Comment


        • #5
          Thanks Erik. That helps!
          Apologies had pasted the margins from another exposure.

          I have the interaction in the model as you suggest.
          And from your answer, I also see that it is important to allow for variation across patients and include the slope in the equation.

          Thanks again.

          Regards,
          Sangeetha

          Comment

          Working...
          X