Announcement

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

  • Interaction term between a categorical variable and a continuous variable

    Dear Statalist respected users,

    I am trying to test an interaction term between a continuous variable and a categorical variable that contains 3 categories (1, 2 and 3). Every time I try to do the interaction, Stata removes one category. is there any way I can keep the 3 interactions? Below is the Stata command syntax I am using and the outputs.

    xtabond2 tobinq l.tobinq c.pc1##i.catvariable ttlassets3 wleverage fcf yr2-yr16, gmm(l.wtobinq pc1 pc2, lag(2 2)) iv(pc3-pc8 ttlassets3 ind1-ind8 yr2-yr16 wleverage fcf) nolevel small robust noconst

    Click image for larger version

Name:	Interaction.jpg
Views:	1
Size:	78.7 KB
ID:	1430556



    I need to keep the three categories if this is possible.
    I also tried creating a categorical variable with 4 categories where the first category contains only 1 observation given the fact that one category should be eliminated by default in Stata, but, again, Stata deleted 2 categories!

    Thanks a lot in advance.

    Kind regards,
    Mohammed

  • #2
    You may try "ibn." instead of "i." for factor notation.
    Best regards,

    Marcos

    Comment


    • #3
      Marcos Almeida

      Thanks a lot for your reply, however, when I replaced i. with ibn., the main regressor (pc1) disappeared from the results. is this normal?

      Comment


      • #4
        Maybe you should consider using the command in #1 and presenting results under - margins - and marginsplot commands. This is just a general approach, for I don’t have experience with - xtabond2- models.
        Last edited by Marcos Almeida; 20 Feb 2018, 01:54.
        Best regards,

        Marcos

        Comment


        • #5
          Thank you

          Comment

          Working...
          X