Announcement

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

  • Margins and marginsplot- Interaction continous by categorical

    Dear all,

    I am running a model with an interaction, namely a categorical by continuous interaction, and first, I am not fully sure how to interpret the coefficients.
    Next, I try and use the -margins- command for easier interpretation, and the -marginsplot- to be able to visualize it. Nevertheless, the graph that is produces does not quite confirm my expectations.
    This is the estimation:
    Code:
    xtreg Y c.X1##i.X2 X3 X4 X5 i.year,  cluster(country)
    This is my output:
    Code:
                            
    ---------------------------------------------------------------------------------
                    |               Robust
                 Y  |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    ----------------+----------------------------------------------------------------
               X1   |  -1.89549    .8972797    -1.12   0.262    -2.774728    .7567906
                    |
           X2       |
        Size1       |  -.6002553   .0789371    -7.60   0.000     -.755596   -.4449147
        Size2       |  -.3301899   .0681068    -4.85   0.000    -.4642174   -.1961624
        Size3       |  -.1841883   .0437547    -4.21   0.000    -.2702933   -.0980833
                    |
    X2#c.X1        
      Size1#c.X1    |  -1.654963   .5004158    -2.26   0.034    -2.116106   -.1465662
      Size2#c.X1    |  -1.88452    .4528056    -2.96   0.005    -2.232939   -.4507842
      Size3#c.X1    |  -.5895839   .3040435    -1.55   0.122    -1.069212    .1274443
                    |
    I omit the rest of the output for the sake of clarity. Now, I am not fully sure on the interpretation of the coefficients. I understand that there is not such thing as a main effect, and so what I should focus on is the interpretation of the interaction.

    After this, I run -margins- and -marginsplot-:
    Code:
    quietly margins X2, at(X1=(0.00 (0.03)0.30))
    
    marginsplot, noci  graphregion(color(white)) bgcolor(white)
    And the graph that I get is just four parallel decreasing lines. Now, I am still a bit confused in understanding the graphing correctly, so apologies if it sounds confusing, but If I expect interaction should the lines not be parallel?

    I appreciate any help that I can get!
    Thank you!

  • #2
    Well, four decreasing lines is what I would expect. But they should not be parallel. They should have slopes of -1.89549, -1.89549-1.654963, -1.89549-1.88452, and -1.89549-0.5895839. With an X1 range from 0 to 0.30, those differences in slope should be readily visible to the eye. Now, it is possible that the graphs don't actually intersect within that range.

    I can't completely emulate your graph without access to all your data and the complete regression output, but here's a relevant simulation of four lines with these slopes, with X2 ranging from 0 to 0.30, and with their y-intercepts separated at the same intervals as your graphs should be. In other words, what I'm showing here should look just like the output you are getting from -marginsplot- except that they may all be shifted up or down on the y-axis by the same amount.

    Code:
    clear*
    
    local c0 0
    local c1 -0.6002553
    local c2 -0.3301899
    local c3 -0.1841883
    
    local b0 -1.89549
    local b1 = `b0'-1.654963
    local b2 = `b0'-1.88452
    local b3 = `b0'-0.5895839
    
    set obs 11
    gen X2 = (_n-1)*0.03
    
    list, noobs clean
    
    forvalues i = 0/3 {
        gen Y`i' = `c`i'' +`b`i''*X2
    }
    
    graph twoway line Y* X2, sort
    Click image for larger version

Name:	Daniela_Fuji.png
Views:	1
Size:	36.3 KB
ID:	1412804


    These lines do not intersect within the range of X2 shown (although if extended further left they would). They are not parallel, although the differences in slopes are modest. If this is what you are getting, it is correct.

    If it is not what you are getting, then I would suggest you post the full code and output as well as an example of the data for additional troubleshooting.

    Comment


    • #3
      Dear Clyde,
      Thank you very much for taking the time to help!
      Yes, that is the graph that I get too. Very relieved! (Base category is the last one in my case- Size 4.) Y-axis would show the predicted values of Y, correct?
      Now regarding the interpretation, considering the output, would it be correct to say that the negative effect of X1 on Y is decreasing as size increases? (or The decrease being more pronounced for size 1 relative to size 3?)

      Also, if I may ask, the -vif- after running -reg- with the interaction term included is relatively high, though that would be expected as a result of the interaction, right? Would It be better to center the IV continuous variable? Or am I safe to ignore this? I have read other threads and also the P. Allison blog, though I am still not sure about the right approach on this.

      Thank you again!
      Last edited by Daniela Fuji; 30 Sep 2017, 17:00.

      Comment


      • #4
        Y-axis would show the predicted values of Y, correct?
        Yes, in your graph. Not necessarily in mine--not having your data, nor the output for the other variables, my graphs may be (are almost certainly) translated to a different vertical location and would not show correct predicted values. But your graphs will.

        Now regarding the interpretation, considering the output, would it be correct to say that the negative effect of X1 on Y is decreasing as size increases? (or The decrease being more pronounced for size 1 relative to size 3?)
        That's almost correct. The negative slope for Size2 is a bit steeper than that for Size 1. So that's "out of order," but you're otherwise correct.

        the -vif- after running -reg- with the interaction term included is relatively high, though that would be expected as a result of the interaction, right?
        Correct. Ignore it.

        Would It be better to center the IV continuous variable?
        In this model, all that would do is shuffle around the constant term and the coefficients of the X2 levels. The slopes (coefficients of X1 and the interaction terms) will not change at all. The two models will give the same predicted values, it's just a re-parameterization. You would get smaller standard errors around the coefficients of the X2 levels and the constant terms--but as these have no intrinsic meaning, that's probably not of much value to you. Your vif results would look a bit better, but again, the vif is just a waste of your time in any case. So I don't really see any reason to do it here.

        There are more complicated models where it would make a real difference to the interpretation of the model. But not in this case.

        Comment


        • #5
          Thank you for the detailed explanation. Understood.

          I would like to express my sincere appreciation for your help Clyde. Again, thank you for taking the time.
          Last edited by Daniela Fuji; 01 Oct 2017, 05:14.

          Comment


          • #6
            Hi Clyde!
            I know this is a delayed reponse, but I was hoping you could help me with an interpretation of a similar graph.

            If I have a continuous by continuous interaction with 5 (differing) positive slopes, is there a significance to their intersection point?

            For example

            margins, at(X1=(60 85) X2=(65(5)85))

            Think of variable X1 as skill at part of a task, and X2 is the percentage of time you spend in a particular role. In this case, they intersect around X1=70. Is there a good interpretation of this?

            Thank you for your response (and apologies for any of my oversights when commenting).

            Comment


            • #7
              I don't think that would have any special meaning. If nothing else, X1 and X2, being a measure of skill and a percentage of time in a role, don't have any obvious commensurability. They are probably measured in different units, so a change of scale would move or eliminate the intersection point even though nothing substantive would have changed.

              Comment


              • #8
                Thank you Clyde! While different skills can be more or less effective in different roles, I could not really see if there was a significance to the intersection. The change in slope is obviously the important piece here, but I did not want to overlook anything. Thank you!

                Comment

                Working...
                X