Announcement

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

  • Use Margins for Interaction terms when model does not support factor notation

    Hi Statalist

    My question is about how we can get Margins commands to work correctly when the estimation model, which includes interaction terms, does not support factor notation.

    Specifically, I understand there are good reasons as to why models such as -xthtaylor- do not support factor notations & I have simply created the interaction terms manually via inter = i.x1 * i.x2 if !missing(x1) & !missing(x2).

    However, this poses a difficulty when it comes to using -margins- & -marginsplot-.

    I note a related discussion from https://www.statalist.org/forums/for...action-effects. Unfortunately I am not yet skilled enough in Stata programming to confidently implement Daniel's solution in that post. I am therefore wondering if anyone might be aware of user-written commands or the like to address this issue?

    Thanks,
    Junran

  • #2
    Much of the discussion you cite refers to multiple imputation. With simple models, you can include x and calculated x-square in the model estimation and then set both the x and x-squared values directly in margins. Whether this works for xthtaylor, I'm not sure.

    Comment


    • #3
      What Junran probably wanted to cite is this thread, started earlier today.

      I am not aware of a command that implements the bogus-approach. I thought about implementing such a program but figured it was too much effort to make it general (and at least half-way safe) enough to handle a wide range of situations, for example, models with multiple equations, such as mlogit, or sem, omitted variables, due to collinearity, etc.

      Best
      Daniel
      Last edited by daniel klein; 18 Nov 2019, 12:08.

      Comment


      • #4
        Thanks Phil and Daniel.

        Yes, I initially asked the above question as I thought it might not be uncommon for models to not use factor-variables & that someone may have already created a program to enable the use of -margins- in those situations. It was only later that I realised Daniel's "bogus" program from the multiple imputation discussion thread is the only one that is applicable. But, as Daniel mentioned above, I should now be citing the other thread specifically on xthtaylor.

        Comment

        Working...
        X