Announcement

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

  • Interpreting margins to understand interactions

    Hi!
    I have a longitudinal linear mixed model with the term:
    Code:
    c.age##c.age##c.age##c.cov1_between
    and some other covariates. Cov1 is a time-varying covariate.
    I also run the model a second time with the within component of cov1 in the interaction term, instead of the between component. What I would like to ask, is in what way I should use margins to understand the results of these interactions. I have thought that, in order to interpret the between-term (each persons average level of cov1), I should use:
    Code:
    margins, at(age=(0 (12) 96) cov1_between=(30 45 60)), atmeans
    This will show how persons with a cov1_between of a certain level change values of dependent variable with age.
    However, for the within-term, the question is whether a change in cov1 level is associated with a corresponding change in the dependent variable. To understand this, should I use:
    Code:
    margins, dydx(cov1_within) at(age=0 (12) 96), atmeans
    Any advice is greatly appreciated!

    Best,
    Kjell Weyde



  • #2
    These look like the right approach to me. But correct the syntax: the commas preceding -atmeans- in both -margins- commands you show are errors.

    Comment


    • #3
      Thank you!
      If I want to know whether there is a significant gender difference in the way age and cov1 interact, should I do:
      Code:
      mixed depvar c.age##c.age##c.age##cov1_between   i.gender
      est store Model1
      mixed depvar c.age##c.age##c.age##cov1_between##i.gender
      est store Model2
      lrtest Model1 Model2
      or
      Code:
      mixed depvar c.age##c.age##c.age##cov1_between  c.age##c.age##c.age## i.gender
      est store Model1
      mixed depvar c.age##c.age##c.age##cov1_between##i.gender
      est store Model2
      lrtest Model1 Model2

      Kjell Weyde

      Comment


      • #4
        If I understand what you want, it would be neither. I would think:

        Code:
         mixed depvar c.age##c.age##c.age##(cov1_between i.gender) cov1_between##i.gender
        est store Model1
        mixed depvar c.age##c.age##c.age##cov1_between##i.gender
        est store Model2
        lrtest Model1 Model2
        Notes: 1. So the idea is that one model includes the full multi-way interaction, and the other includes all interactions at lower levels.
        2. The use of cov1_between without a c. or i. implies that Stata will treat it as i. I don't remember enough about your data to know if that is correct or not. In general, I recommend always using explicit c. or i. rather than relying on the default behavior, just so the code is completely transparent, and to avoid mistakes.
        Last edited by Clyde Schechter; 25 Oct 2016, 12:15. Reason: The editor had jumbled everything in my code block to a single line. I fixed that.

        Comment


        • #5
          Thanks again for the advice!
          Now, I have compared two models in order to assess the significance of interactions. According to both AIC and BIC, the added interaction terms are not improving the model. In addition, none of the interaction coefficients in the output are significant (see below). However, the LR-test is significant. How should this be interpreted? (Code for the models shown below.)

          Code:
          mixed bmi c.age##c.age##c.age##(c.noise10_bp##c.logincome_bp i.gender) c.noise10_bp##c.logincome_bp##i.gender noise10_wp logincome_wp bane_wp bane_bp TV_wp TV_bp sone_wp sone_bp skilt_wp skilt_bp i.utdanning i.etnisitet logbmimor i.ammet if svlen>=259&svlen<302 || PREG_ID_1569: age, mle cov(un) residuals(exp, t(zeit))
          est store x_kjønn_bp4
          estat ic
          
          mixed bmi c.age##c.age##c.age##c.noise10_bp##c.logincome_bp##i.gender noise10_wp logincome_wp bane_wp bane_bp TV_wp TV_bp sone_wp sone_bp skilt_wp skilt_bp i.utdanning i.etnisitet logbmimor i.ammet if svlen>=259&svlen<302 || PREG_ID_1569: age, mle cov(un) residuals(exp, t(zeit))
          est store x_kjønn_bp5
          estat ic
          
          lrtest x_kjønn_bp4 x_kjønn_bp5
          Click image for larger version

Name:	m0.png
Views:	2
Size:	6.3 KB
ID:	1361740



          Click image for larger version

Name:	m1.png
Views:	2
Size:	10.3 KB
ID:	1361742

          Click image for larger version

Name:	int.png
Views:	1
Size:	11.0 KB
ID:	1361741

          Attached Files

          Comment


          • #6
            It's important to remember that the AIC/BIC approach answers a different question from the one answered by the likelihood-ratio test, and the individual significance tests of the interaction terms answer different questions still. Three separate questions--no reason they all have to have the same answer.

            The likelihood-ratio test is a joint test of the hypothesis that all of the interaction coefficients are zero. The results of this do not have to be the same as the disjunction of the significance of the individual interaction terms, which look at them one at a time. The individual terms can be not significant but the joint effect significant, and it can also go the other way. The AIC and BIC statistics attempt to determine whether the improvement in fit from adding the terms is "worth the cost" of adding variables to the model. It attempts to guide you to the most parsimonious model. These are different objectives.

            As always, which statistics to focus on depends on the research goals. If your goal is to build a parsimonious model of your outcome variable, then the AIC and BIC are your guides here. If, however, your goal is to test a hypothesis about whether gender modifies the interactions among those several other variables, then AIC and BIC are irrelevant and the likelihood ratio test is your guide. The individual interaction term tests are irrelevant in either case, unless you have another specific hypothesis about a specific effect of one gender on some specific piece of the interaction of the others.

            Comment


            • #7
              After obtaining the margins, I get a marginsplot that looks like this:
              Click image for larger version

Name:	image025.png
Views:	1
Size:	5.6 KB
ID:	1361948


              The blue line shows how bmi changes with age for children exposed to an average nocturnal noise level of 35 decibel, whereas the red is children exposed to 60 decibel. As previously assessed with a LR test, the interaction term including age (up to ^3) and average noise exposure is significant. In the plot, the differences seem to be greatest at age 96 months. Is there any good way of assessing the significance of this difference? In addition, how careful should one be when interpreting results at the "endpoint" (96 months), especially regarding the fact that the number of participants is lowest here, and that the tail of the graph is perhaps vulnerable to model specification (i.e., how many age terms are included in the iteraction etc..)?

              Kjell Weyde

              Comment


              • #8
                If you rerun -margins- adding the -pwcompare- option you will get tests of the differences between each pair of margins calculated.

                I would be pretty cautious drawing any conclusions anywhere in the range of age here. It is quite clear that the effect of noise exposure is really tiny compared to the inherent variation in the bmi associated with age. Evidently the effect is large enough and you were able to measure it precisely enough that you came up with statistically significant results for the overall interaction, perhaps because your sample is very large. Or you may have just stumbled on a Type I error. But it looks like your largest mean difference amounts to something like a BMI of 16 vs BMI of 16.2. Is that clnically meaningful (even conceding that it might be statistically significant)?

                Comment


                • #9
                  I ran margins with the pwcompare option, and found that the differences observed were not significant, apart from that at birth. The differences at age 96 months and birth are similar, but only significant at birth, perhaps due to a larger sample size at that age.

                  I have also obtained margins using the dydx option. The example here is made with the code:
                  Code:
                  margins, dydx(noise_wp) at(age=(0 18 36 60 84 96) logincome_bp=(4.5 6)) atmeans
                  with the following marginsplot:
                  Click image for larger version

Name:	image042.png
Views:	1
Size:	5.7 KB
ID:	1362165

                  The blue line is logincome_bp=4.5, and the red logincome_bp=6. Is it correct to say that, for example, at age 60 months, if logincome_bp = 4.5 and the noise_wp increases by one unit (which is 10 decibel in this case), then the bmi is reduced by 1 unit? And, if this is correct, could one say that for a one unit decrease in noise_wp, bmi is expected to increase by one unit?

                  Kjell Weyde

                  Comment


                  • #10
                    Your graph and your -margins- command do not correspond to each other. The former uses a variable noise_wp, and the graph referes to marginal effects of some other variable stoy10_wp. Actually, none of the variables on the graph are shown in your -margins- command. So you can't draw any conclusions about the effect of noise_wp from this graph. But your general approach to the interpretation of the graph is close to correct.

                    The marginal effect of a continuous variable is, as the notation in the -margins- command suggests, the first derivative of the outcome with respect to the variable whose marginal effect you are estimating. If the model is linear, then this is also the expected difference in outcome associated with a unit difference in that variable. However, for non-linear models the expected difference associated with a discrete unit change in that variable could be differently (and usually is). One could say that the marginal effect is the rate of change in the outcome per unit difference in the variable for small differences in the variable. Looking at your earlier posts in this thread, I also see no variable noise_wp in the regression models you showed, so I don't if the model you are talking about now is linear in noise_wp.

                    Comment


                    • #11
                      Dears need your help in interpreting ME and marginsplot. I am estimating the marginal effect of skilled birth attendants in the differences in the covariates: education and wealth quintile. All the variables are categorical. Education is categorized as no education, primary and secondary and above; and wealth quintile, as quintile 1 (poor), quintile 2 (middle), and quintile 3 (rich). The outcome variable is binary (Yes/No). The ME table and margins plot is uploaded. Thank you for your support.
                      Attached Files

                      Comment

                      Working...
                      X