Announcement

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

  • Need some advice on covariates in mixed effects model

    Hi all, i am struggling pretty hard with my mixed effect model and I would really appreciate some help. I have a 4 (time) by 2 (intervention) model looking at a dependent variable of subjective anxiety ratings (on a scale of 0-100). Participants subjective anxiety was taken at pre-test, post-test, and 2 follow-up points.

    The basic code is this: mixed anxiety i.time##intervention || id:

    However, all participants completed measures of depression too. I added a co-ariate of baseline depression to the model and it was significant. I then added depression scores as an interaction like this: mixed anxiety i.time##cond c.depress##i.time c.depress##cond || id:

    The interaction terms were also significant in Stata's read out. Where I am stuck is that I want to see how the depression scores affected the rate of change (or slope) from different time points. For instance, when people have higher depressive scores, does one intervention work better in reducing anxiety from pre-test to post-test.

    I would love some insight on how to get these from the mixed model. Thanks in advance for your time!




  • #2
    The -margins- command is the easiest way to get at this.

    Code:
    margins intervention, dydx(time) at(depress = 0(10)100)
    will show you how the anxiety measure changes at each passage to the next time in each intervetnion arm at each value of depression score = 0, 10, 20,...100. (I chose those numbers because that is the scale of your depression score. But you might substitute different numbers that correspond to more interesting values, or if much of the 0-100 range is seldom or never reached in practice.)

    And if you run -marginsplot- immediately after that, you will probably find the graphs even more illuminating.

    Comment


    • #3
      Originally posted by Clyde Schechter View Post
      The -margins- command is the easiest way to get at this.

      Code:
      margins intervention, dydx(time) at(depress = 0(10)100)
      will show you how the anxiety measure changes at each passage to the next time in each intervetnion arm at each value of depression score = 0, 10, 20,...100. (I chose those numbers because that is the scale of your depression score. But you might substitute different numbers that correspond to more interesting values, or if much of the 0-100 range is seldom or never reached in practice.)

      And if you run -marginsplot- immediately after that, you will probably find the graphs even more illuminating.
      Clyde, this is incredibly helpful, thank you so much!

      Comment


      • #4
        Originally posted by Clyde Schechter View Post
        The -margins- command is the easiest way to get at this.

        Code:
        margins intervention, dydx(time) at(depress = 0(10)100)
        will show you how the anxiety measure changes at each passage to the next time in each intervetnion arm at each value of depression score = 0, 10, 20,...100. (I chose those numbers because that is the scale of your depression score. But you might substitute different numbers that correspond to more interesting values, or if much of the 0-100 range is seldom or never reached in practice.)

        And if you run -marginsplot- immediately after that, you will probably find the graphs even more illuminating.
        Clyde, I wanted to double check the interpretation of the output. FYI in my "Time" variable, Pre-Test is coded "0", Post-test as "1", and the follow-up points as "3" and "4". It looks like the output is comparing post-test to each time point (comparing the two interventions on various levels of depression). Is that correct?

        Comment


        • #5
          It looks like the output is comparing post-test to each time point (comparing the two interventions on various levels of depression). Is that correct?
          It would have been better had you posted the actual output so that we could discuss things in specific terms. I don't know what you mean by "comparing post-test to each time point" and I can imagine a meaning which would be correct and others which would not. I realize that the output is very extensive with 2 intervention levels X 11 depression scores for each of the 4 values of time. To simplify it, why don't you re-run using just, say two levels of depress- and post the entire output. (Be sure to put it between code delimiters so it aligns readably.) Then we can discuss specific numbers and say what they mean.

          Comment


          • #6
            Originally posted by Clyde Schechter View Post
            It would have been better had you posted the actual output so that we could discuss things in specific terms. I don't know what you mean by "comparing post-test to each time point" and I can imagine a meaning which would be correct and others which would not. I realize that the output is very extensive with 2 intervention levels X 11 depression scores for each of the 4 values of time. To simplify it, why don't you re-run using just, say two levels of depress- and post the entire output. (Be sure to put it between code delimiters so it aligns readably.) Then we can discuss specific numbers and say what they mean.
            Sounds great Clyde, I look forward to hearing your thoughts. I also attached a pic of the marginsplot command I ran after.

            Code:
             margins cond, dydx(time) at(depress= (10 100))
            
            Conditional marginal effects                    Number of obs     =        154
            
            Expression   : Linear prediction, fixed portion, predict()
            dy/dx w.r.t. : 1.time 2.time 3.time
            
            1._at        : depress         =          10
            
            2._at        : depress         =         100
            
            -------------------------------------------------------------------------------
                          |            Delta-method
                          |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
            --------------+----------------------------------------------------------------
            1.time        |
            _at#condition |
                     1 1  |  -47.01025   11.80665    -3.98   0.000    -70.15085   -23.86964
                     1 2  |  -38.29375    12.1656    -3.15   0.002     -62.1379   -14.44961
                     2 1  |  -9.065552   7.250974    -1.25   0.211     -23.2772    5.146096
                     2 2  |  -.3490604   7.294739    -0.05   0.962    -14.64649    13.94837
            --------------+----------------------------------------------------------------
            2.time        |
            _at#condition |
                     1 1  |  -25.97528   11.92707    -2.18   0.029    -49.35191    -2.59865
                     1 2  |  -34.10173   12.43502    -2.74   0.006    -58.47392   -9.729535
                     2 1  |   2.989579   7.561947     0.40   0.693    -11.83156    17.81072
                     2 2  |   -5.13687   7.403161    -0.69   0.488     -19.6468    9.373058
            --------------+----------------------------------------------------------------
            3.time        |
            _at#condition |
                     1 1  |  -32.35365    11.8139    -2.74   0.006    -55.50847   -9.198837
                     1 2  |  -46.79744   12.22902    -3.83   0.000    -70.76587     -22.829
                     2 1  |   5.513728   7.392554     0.75   0.456    -8.975411    20.00287
                     2 2  |  -8.930052    7.32019    -1.22   0.222    -23.27736    5.417256
            -------------------------------------------------------------------------------
            Note: dy/dx for factor levels is the discrete change from the base level.
            
            . 
            end of do-file
            Click image for larger version

Name:	Anxiety Depress Figure.JPG
Views:	1
Size:	70.5 KB
ID:	1405226

            Comment


            • #7
              OK. So first, an orientation to the output table. There are three "panels" stacked vertically. Each one corresponds to one value of the time variable (time = 1, time = 2, and time = 3) and, this being a marginal effects output, the values within a given panel are a contrast of the difference between that panel's particular value of time, and the reference value of time (which, in your case, is 0). Within each panel there are four rows of output. Each of those rows is headed by two numbers, each of which is either 1 or 2. The first number is a code for the value of the depression score. The two lines above the table explain that in this case 1 encodes depression = 10 and 2 encodes depression = 100. The second number is the value of the variable condition. So all four combinations of depression (10 vs 100) and condition (1 and 2) are represented in each panel.

              So let's focus on the very first row of the table, which gives the marginal effect of 1.time (relative to 0.time) when condition = 1 and depression = 10. To one decimal place, the value given is -47.0. This means that, conditional on condition = 1 and depression = 10, the expected value of the outcome variable when time = 1 is 47.0 lower then the expected value when time = 0. Thinking of time as a variable marking the passage of time, one might also phrase this as: from time 0 (pre-test) to post-test 1 (time = 1) the expected value of the outcome measure declines by 47.0 in the group assigned to condition = 1 if the depression score is 10. There is, of course, uncertainty in this estimate. The 95% confidence interval is from -23.9 to -70.2, so there is a fairly large imprecision in this estimate. If you are interested in testing the (straw man?) null hypothesis that the change in this group is zero, we have a z statistic of -3.98, corresponding to p = 0.000 (which really means p < 0.0005).

              By contrast, in condition 2, with the same depression score (10), the passage of time from pre-test to first post-test is associated with a decline of 38.3 in the outcome measure, with 95% CI -14.4 to -62.1, as can be seen in the second row of the 1.time panel.

              The entire table can be read in this way giving you the change from pre-test to each of the three post-tests in both conditions and at both levels of depression.

              If you are interested in the differences between the two conditions at each time (again fixing selected values of depression) you use a different -margins- command that interchanges the roles of cond and time:

              Code:
              margins time, dydx(cond) at(depres = (10 100))
              I think the most obvious takeaway from the graph is that the effect of the difference in depression score from 10 to 100 dwarfs any of the combinations of the condition and time effects. (Of course, I imagine that the difference between a depression score of 10 and 100 is a massive difference and that few people in the data appear at either of these extremes. I would imagine that more typical depression scores like, say 40 vs 60, would be associated with smaller outcome differences that might, in fact, be comparable to the effects shown by time and condition.) The condition and time effects themselves, at either level of depression seem fairly small and the confidence intervals appear to substantially overlap (though I have not in detail looked at each confidence interval to compare it with all of the others).

              It might also be helpful to re-run -margins- and -marginsplot-, this time specifying the -xdimension(time)- option in the -marginsplot- command. This way the graph will put your four time points on the horizontal axis, and there will be separate lines for each depression level. This would make the graphs correspond to time-trajectories of the groups at each depression levels, which might be a more natural way to look at the data in this setting.
              Last edited by Clyde Schechter; 05 Aug 2017, 19:32.

              Comment


              • #8
                Originally posted by Clyde Schechter View Post
                OK. So first, an orientation to the output table. There are three "panels" stacked vertically. Each one corresponds to one value of the time variable (time = 1, time = 2, and time = 3) and, this being a marginal effects output, the values within a given panel are a contrast of the difference between that panel's particular value of time, and the reference value of time (which, in your case, is 0). Within each panel there are four rows of output. Each of those rows is headed by two numbers, each of which is either 1 or 2. The first number is a code for the value of the depression score. The two lines above the table explain that in this case 1 encodes depression = 10 and 2 encodes depression = 100. The second number is the value of the variable condition. So all four combinations of depression (10 vs 100) and condition (1 and 2) are represented in each panel.
                Clyde, thank you so much for taking the time to write all of this up, it is incredibly helpful! I feel like I understand the mixed model much better now, and this will be extremely useful for further analyses I am planning on. Again, I greatly appreciate your input and feedback. Thank you!!

                Comment

                Working...
                X