Announcement

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

  • Plotting Interactions after xtreg

    Hello everyone,

    I am currently struggling to create a graph to visualize the moderation effect in my panel regression:

    Code:
     xtreg ROA_centered_industry MarkCap_centered_industry c.MarkCap_centered_industry#DigitalisierunglowHigh c.MarkCap_centered_industry#DigitalisierunglowHigh#c.Firm_Size_centered c.MarkCap_centered_industry#c.Firm_Size_centered OpCap_centered_industry c.OpCap_centered_industry#DigitalisierunglowHigh c.OpCap_centered_industry#DigitalisierunglowHigh#c.Firm_Size_centered c.OpCap_centered_industry#c.Firm_Size_centered c.MarkCap_centered_industry#c.OpCap_centered_industry c.MarkCap_centered_industry#c.OpCap_centered_industry#DigitalisierunglowHigh c.MarkCap_centered_industry#c.OpCap_centered_industry#c.Firm_Size_centered DigitalisierunglowHigh Firm_Size_centered Firm_Age, re vce (cluster GlobalCompanyKey)
    I am interested in visualizing the moderation effect of digitalization and Firm_Size on MarkCap. The graph I want to produce should possibly look something like this for each moderation variable:

    Click image for larger version

Name:	moderation_graph.PNG
Views:	1
Size:	4.9 KB
ID:	1520549

    The two lines indicate two different levels of the moderation variables. The moderator digitalisierunglowHigh just takes two values (1 or 2) so I guess some form of this graph should be possible.
    For the second moderator (Firm_Size) I guess it becomes more difficult as the variable is continuous. I was told that I could simply define a cut-off value (e.g. the mean) to split the values into two categories low/high for the graph. I was wondering if this would affect my regression? If the suggested graph would not be possible does anybody have an idea how to visualize the moderation effect of a continuous moderator?

    I have found this thread:

    https://www.statalist.org/forums/for...teraction-plot

    but as I'm quite new to Stata I'm struggling to understand and apply it.
    I somehow tried to apply the margins command and received:
    Code:
     margins c.MarkCap_centered_industry#DigitalisierunglowHigh
    only factor variables and their interactions are allowed
    Does this mean that I can't use the margins command as MarkCap is a continuous variable?

    Thanks in advance!

    Best,
    Till

  • #2
    You can, but continuous variable are handled differently, with the -at()- option. What you want is
    Code:
    margins DigitalisierunglowHigh, at(MarkCap_centered = (numlist))
    marginsplot
    Replace numlist by a list of numerical values of MarkCap_centered that span the range of interest and that are close enough together to give a smooth looking graph when connected.

    Comment


    • #3
      Thank you for your answer Clyde!

      Unfortunately it seems like there is another issue...
      The margins command seems to work fine

      Code:
      margins DigitalisierunglowHigh, at(MarkCap_centered_industry = (-58 -50 -40 -30 -20 -10 0 10 20 27
      but for the marginsplot I receive the following error message:
      Code:
       marginsplot
      invalid at() dimension information;
      using variable DigitalisierunglowHigh as a factor variable and a regular variable is not supported
      I found this thread on the same issue:
      https://www.statalist.org/forums/for...mension-errors

      but as DigitalisierunglowHigh is in my opinion only considered as factor variable in the xtreg command I do not fully understand the issue (or how to use the suggested solution in the other post)

      Comment


      • #4
        You have exactly the problem that is pointed out in the other thread to which you linked in #3. The variable DigitalsisierunglowHigh has been used as both a factor variable and a continuous variable in the regression command, and -marginsplot- does not permit that.

        Code:
        xtreg ROA_centered_industry MarkCap_centered_industry ///
            c.MarkCap_centered_industry#DigitalisierunglowHigh ///
            c.MarkCap_centered_industry#DigitalisierunglowHigh#c.Firm_Size_centered ///
            c.MarkCap_centered_industry#c.Firm_Size_centered OpCap_centered_industry ///
            c.OpCap_centered_industry#DigitalisierunglowHigh ///
            c.OpCap_centered_industry#DigitalisierunglowHigh#c.Firm_Size_centered ///
            c.OpCap_centered_industry#c.Firm_Size_centered ///
            c.MarkCap_centered_industry#c.OpCap_centered_industry ///
            c.MarkCap_centered_industry#c.OpCap_centered_industry#DigitalisierunglowHigh ///
            c.MarkCap_centered_industry#c.OpCap_centered_industry#c.Firm_Size_centered ///
            DigitalisierunglowHigh Firm_Size_centered Firm_Age, re vce (cluster GlobalCompanyKey)
        The continuous variable usage is shown in bold red. Put an i. in front of that and your problem will go away. Better still, don't use # for interactions. Use ## and don't separately mention the constituent variables of the interaction. That will also avoid this problem.

        Comment


        • #5
          Thank you Clyde for your answer!
          One last question.
          Is there a way to create a similar graph for the continuous moderator (Firm_Size) without changing the underlying regression? So that I only get two lines (e.g. below the mean vs. above the mean of Firm_Size_centered)?

          Comment


          • #6
            I don't think so. You have to create a new dichotomous variable that indicates above or below the mean of Firm_Size_centered, and then re-do the regression using that.

            Comment

            Working...
            X