Announcement

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

  • Comparing Effects of Two-Way Interaction Nest in Three-Way Interaction

    Dear Statalist,

    I am currently dealing with the analysis of a three-way interaction of all continuous variables, XZW. My regression equation looks like this:

    Code:
    reg y c.X##c.Z##c.W control1 control2 control3 control4 control5
    Essentially, one of my hypotheses is that the effect of the interaction "X*Z," that is the slope of how X is moderated by Z, should vary across levels of "W." In particular, I'm interested in testing whether the difference in the effect of the X*Z interaction is statistically different between the 10th (value of -.25) and 90th (value of .75) percentile values of W. Graphically, they appear to be different and often go in opposite directions, but I need a way to formally test this difference. Margins, of course, does not allow me to compute this using:
    Code:
    margins, dydx(c.X##c.Z) at(W=(-.25 .75)
    I've looked at the contrast function and it appears as though that would work if the W variable were dichotomous, but since it is continuous (and dichotomizing it would lose a lot of information), I am stuck.

    I've read through Aiken and West's (1991) Multiple Regression: Testing and Interpreting Interactions and received good advice from a number of individuals who I've reached out to. These have helped orient me in figuring out what exactly my question was (what I am interested in to test my hypothesis), but I'm still stuck in executing it.

    If anyone has any help or suggestions I would much appreciate them. Thank you!

    Clinton

  • #2
    There is a good reason that -margins- won't let you do what you show. That's because there is no such thing as "the effect of the X*Z interaction." It is good that you have already invested some time trying to clarify what your question is, but you still have not reached a question that makes statistical sense. You need to pursue it farther, in particular, clarifying what you mean when you refer to the non-existent "effect of the X*Z interaction." To do that, you might want to select representative values of X, Z, and W from your data set and then run:

    Code:
    margins, at(X = (interesting_values_of_X) Z = (interesting_values_of_Z) W = (interesting_values_of_W)
    marginsplot, xdimension(W) bydimension(X)
    This will give you a sense of how the dependence of your outcome on X and on Z varies with W. Doing other -marginsplot-s with other choices of -xdimension()- and -bydimension()- may also be helpful. Perhaps looking at those graphs will help you to say more specifically what it is you are trying to show.
    Last edited by Clyde Schechter; 07 Jan 2018, 12:28.

    Comment


    • #3
      Originally posted by Clyde Schechter View Post
      There is a good reason that -margins- won't let you do what you show. That's because there is no such thing as "the effect of the X*Z interaction." It is good that you have already invested some time trying to clarify what your question is, but you still have not reached a question that makes statistical sense. You need to pursue it farther, in particular, clarifying what you mean when you refer to the non-existent "effect of the X*Z interaction." To do that, you might want to select representative values of X, Z, and W from your data set and then run:

      Code:
      margins, at(X = (interesting_values_of_X) Z = (interesting_values_of_Z) W = (interesting_values_of_W)
      marginsplot, xdimension(W) bydimension(X)
      This will give you a sense of how the dependence of your outcome on X and on Z varies with W. Doing other -marginsplot-s with other choices of -xdimension()- and -bydimension()- may also be helpful. Perhaps looking at those graphs will help you to say more specifically what it is you are trying to show.
      Thank you for your push to clarify further, Clyde. Perhaps more clearly stated: I am interested in determining how the moderating effect of Z on X (X*Z interaction) changes with respect to values of W. And if the difference in the moderating effect of Z on X is distinct between the 10th and 90th percentile values of W. Starting with your suggestion above, I explored the data some more and finally came upon a graph that might help me clarify what I'm trying to do. The code I used to create the graph is as follows:

      Code:
      reg y c.X##c.Z##c.W control1 control2 control3 control4 control5
      
      margins, dydx(X) at(Z =(0(.2)1) W=(-.25 .75))
      marginsplot, recastci(rline) yline(0, lcolor(red))
      This is a graph showing the marginal effect of X across all levels of Z, created at two levels of interest of W (10th and 90th percentile). What I am interested in is contrasting the slopes of the two lines to see if they are statistically distinct from one other so that I can determine if Z moderates X statistically differently between the two levels of W. That is, are the slopes of these two lines distinct? My understanding is that the contrasts function could do this if at least one of my variables were dichotomous or a factor variable. Unfortunately, dichotomizing or factoring my variables would lose quite a lot of information.

      I hope this clarifies my question and apologies for any lack of clarity upfront. Any suggestions or insight are very much appreciated. Thank You!

      Click image for larger version

Name:	Marginal Effect X Example.png
Views:	1
Size:	59.6 KB
ID:	1424931
      Last edited by Clinton Jenkins; 08 Jan 2018, 14:05. Reason: Forgot to upload picture, added to post.

      Comment


      • #4
        OK, so the marginal effect of X is a function of Z and W. For any fixed value of W, the marginal effect of X is a linear function of Z. And you want to contrast the slopes of those two linear functions at two specified values of W. While looking at -marginsplots- made it clear what you want, it seems to me that you will have a difficult time extracting a test of this from -margins- itself. I think you have to resort to -lincom- for this, because what you are really interested in is the difference in the partial derivative of the marginal effect of X with respect to Z between two different values of W. A little algebra and calculus suggests that you want:

        Code:
        lincom _b[c.X#c.Z#c.W]*(0.75 - (-0.25))
        Now, by happy coincidence, the difference between the two values of W you have singled out is precisely 1, so we don't even need -lincom- for this: just read off the output of -regress- for the three-way interaction term c.X#c.Z#c.W. (Remember, skipping -lincom- and going back to the regression output is only possible here because the two values of W you picked differ by 1. If you need to redo this for other values of W, then you will need to use -lincom- along the lines shown.)
        Last edited by Clyde Schechter; 08 Jan 2018, 15:22. Reason: Correct typo.

        Comment


        • #5
          Clyde, Thank you for your response and the assistance. This is very helpful!

          Comment

          Working...
          X