Announcement

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

  • Comparing Margin estimate of 2 models

    Hi Experts,

    I'm new to stata and I have a question regarding comparing only one item of margin estimate. Below is my codes:

    eststo model1: glm y i.a##i.b##i.c
    margins i.a##i.b##i.c

    eststo model2: glm y i.a##i.b##i.c if d=1
    margins i.a##i.b##i.c

    After I run this, I'll get 2 big tables and the "margin" column have estimates of all predictors and different interactions(i.a##i.b##i.c will give you 3 ways interactions). Is there a way I can easily compare only the i.a#i.b#i.c across 2 models? Which is the last interaction of the table.

    Thank you very much!

  • #2
    I want to extract part of matrix from 2 models and put them into one giant table and compare them. Any help will be appreciate!

    Comment


    • #3
      That does not look like correct syntax to me but maybe it is not the syntax you actually ran.

      I might do something like

      margins i.a##i.b##i.c, post
      est store marg1
      .
      .
      margins i.a##i.b##i.c, post
      est store marg2

      estimates table marg1 marg2
      -------------------------------------------
      Richard Williams, Notre Dame Dept of Sociology
      Stata Version: 17.0 MP (2 processor)

      EMAIL: [email protected]
      WWW: https://www3.nd.edu/~rwilliam

      Comment


      • #4
        Originally posted by Richard Williams View Post
        That does not look like correct syntax to me but maybe it is not the syntax you actually ran.

        I might do something like

        margins i.a##i.b##i.c, post
        est store marg1
        .
        .
        margins i.a##i.b##i.c, post
        est store marg2

        estimates table marg1 marg2
        Thank you Richard!! This will combine these 2 whole tables together, do you know how to only extract part of the matrix, and stack them together? Since I will have a really big table if add more interactions. Here, I only want to stack the last item of the table, which is i.a#i.b#i.c. Thank you again

        Comment


        • #5
          Read up on Stata's matrix commands. You can use them to extract parts of matrices. I don't have Stata handy now, but I suspect commands like esttab will let you only show parts of the results.
          -------------------------------------------
          Richard Williams, Notre Dame Dept of Sociology
          Stata Version: 17.0 MP (2 processor)

          EMAIL: [email protected]
          WWW: https://www3.nd.edu/~rwilliam

          Comment


          • #6
            In the call to margins, specify the interaction operator (#) instead of the full factorial interaction operator (##).
            Code:
            margins i.a#i.b#i.c, post

            Comment


            • #7
              Thank you Richard and Jeff!! your suggestions are really helpful.BTW, I found a commend which calls matselrc can select specific rows and columns.

              Comment

              Working...
              X