Announcement

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

  • Graph of interaction between 2 continuous variables in fixed effects panel model

    Hello Statalist members,

    I am running a fixed effects poisson model using xtpoisson looking at the effect of 2 continuous variables and the interaction between these on a count outcome variable.
    My code is as follows:

    xtpoisson depvar var1 var2 var1Xvar2, fe

    The interaction effect is significant (β=0.145, SE=0.051, p=.005) so in order to understand what direction the effect is in I run marginscontplot to picture the interaction using this code:

    marginscontplot var1 var2 , var1(20) var2(3) margopts(predict (iru0))


    This is the graph that is produced.

    My question is what does the scale on the y-axis refer to? As I am looking at within person changes over time it clearly is not a count, but what it is I don't know.

    Many thanks for any help,

    Jessica


  • #2
    If you want to use margins and marginsplot you will have to use the factor variable notation to create the interaction terms. So your command should have been xtpoisson depvar c.var1##c.var2, fe. A useful alternative would be to specify the irr option, and interpret the interaction term directly. See for examples here: http://maartenbuis.nl/publications/interactions.html
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      marginscontplot is a user-written command from SJ, as you are asked to explain.

      Concerning your syntax, did you really type

      Code:
      xtpoisson depvar var1 var2 var1Xvar2, fe
      If you did, I assume you have before typed something like

      Code:
      generate var1Xvar2 = var1 * var2
      If this is the case, i.e. you have created the interaction term yourself, then margins will fail to give the correct answer and so will marginscontplot.

      Instead type

      Code:
      xtpoisson depvar var1 var2 c.var1#c.var2 ,fe
      and see help fvvarlist for more on factor variable notation.


      The y-axis should correspond to whatever you predicted, which is the incidence rate and assumes that the fixed-effects are 0 according to the help file entry on the iru0 option for predict after xtpoisson.


      Graphical representation of an interaction effect is very useful and I highly recommend it, but the direction of the effect can also be derived from the coefficients alone.

      Best
      Daniel

      Comment


      • #4
        Thanks very much for the help. I did indeed create my own interaction variable as you showed. Now using the factor variable notation my graph looks totally different and I also understand the y-axis.

        Best
        Jessica

        Comment


        • #5
          Note that Maarten's suggestion might lead to problems when one of the variables does not vary within panel-units and read more about this purely technical problem.

          Best
          Daniel

          Comment

          Working...
          X