Announcement

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

  • Mixed effects linear regression post-hoc tests

    Dear Statalist,

    I am using mixed effects linear regression model to examine the relation between depression (3-level categorical variable) and blood pressure (repeated measure outcome variable, continuous) over 3 years.

    I am trying to assess whether the 3 depression groups (low, mid, high) are different in terms of their blood pressure, at baseline and over time. I am not sure whether my syntax (copied below) captures this or not and need your advice.

    Thanks in advance for your help.


    Model:
    mixed bp depression##c.year || id: year, covariance(unstructured)

    Test for differences between groups at baseline (I use the Joint test):
    margins r.depression, at (year=(0)) contrast

    Test for differences between groups over time (I use the Joint test):
    margins r.depression, at (year=(0(1)3)) contrast

    Test for interaction between depression and time:
    contrast depression#c.year

  • #2
    Ahmed:
    your codes look reasonable.
    Although nothing changes in the way Stata calculated -mixed- and -margins-, as a cautionary tale I would have added an -i.- before the categorical variable -depression-.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Hi Ahmed,

      I guess you'll have to "experiment" a lot with different models whenever dealing with mixed models.
      You can start with the "full loaded" model and then perform comparisons with reduced models, selecting itens for the random effects, including (or not) square terms ("age", for example), and see if the model shows improvement, exclusion of nonsignificant fixed effects, etc.
      When it comes to mixed models, I think it might be too risky to perform just one model, and stick to it.

      Best,

      Marcos
      Best regards,

      Marcos

      Comment


      • #4
        Carlo: thanks for confirming my code. I think it didn't work when I had the i. , but will check it again. Marcos: I only included the base model for simplicity, but thanks for the tip Thanks again and all the best for both of you.

        Comment


        • #5
          Hi, Ahmed. I was just thinking about suggesting you use the "indicator" for your factors, but Carlo already explained it. Also, Carlo gave additional information on the "mixed" command in a message from today.

          You've probably already typed "help mixed postestimation". There are lots of interesting and practical information over there. Enough, concerning mixed models.

          But, just to give some food for thought, I'm wondering whether your design couldn't eventually match with "xtreg" as well.

          For example:

          Code:
          . xtset id
          . xtreg bpress age c.age#c.age i.group, vce(robust)
          This way you would get the coefficients, the between-subject SD of the random intercept for "id" (/sigma_u), the within-subject SD (/sigma_e) and the rho, that implies "reliability".

          By the way, the option "re" (for random effects) is not necessary here, because it is the default.

          Hope it might be of some help.

          Best,

          Marcos
          Last edited by Marcos Almeida; 04 Jan 2015, 15:15.
          Best regards,

          Marcos

          Comment


          • #6
            Thank you Marcos for the great suggestions.

            Ahmed

            Comment

            Working...
            X