Announcement

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

  • etable - is there a way to add the results from margins command in thee results table?

    Hi All,

    I am trying to create a results table using etable command. I have also run the margins command to get the net effects of a variable and I want to include those results in the table with regressions coefficients. Is there a way to include the marginal effects in the table? Thanks in advance.

    Regards,
    Preety

  • #2
    Check out the estadd command, which is part of the user-written estout package.

    https://repec.sowi.unibe.ch/stata/es...lp-estadd.html
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 18.5 MP (2 processor)

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

    Comment


    • #3
      Without some data and an example or detailed description, it is not clear exactly what table you are looking to build.

      Let's use some data and code to show some basic things you can do with etable and collect for building your table. In the following I modify an example in the manual entry [R] etable. First I load some data, fit a linear regression, and store its results under the name fit, then use margins to compute the marginal effects. In the call to margins I use option post so that it posts its results to e(), which I then store under the name dydx. Finally, I use etable to build a table from these two sets of estimation results.
      Code:
      webuse nhanes2l
      
      regress bpsystol c.age##c.age weight i.region
      estimates store fit
      
      margins, dydx(*) post
      estimates store dydx
      
      etable, estimates(fit dydx) column(estimates)
      Here is the resulting table.
      Code:
      -----------------------------------------
                                  fit     dydx 
      -----------------------------------------
      Age (years)                -0.359   0.660
                                (0.082) (0.011)
      Age (years) # Age (years)   0.011        
                                (0.001)        
      Weight (kg)                 0.428   0.428
                                (0.013) (0.013)
      Region                                   
        MW                       -0.364  -0.364
                                (0.560) (0.560)
        S                        -0.583  -0.583
                                (0.556) (0.556)
        W                        -1.057  -1.057
                                (0.567) (0.567)
      Intercept                  90.338        
                                (1.880)        
      Number of observations      10351   10351
      -----------------------------------------
      You can then use the collect suite of commands to further customize your table. For example, I use the following command to restrict the colname dimension to the age coefficients and effects.
      Code:
      collect style autolevels colname age age#age
      collect preview
      Here is the resulting table.
      Code:
      -----------------------------------------
                                  fit     dydx 
      -----------------------------------------
      Age (years)                -0.359   0.660
                                (0.082) (0.011)
      Age (years) # Age (years)   0.011        
                                (0.001)        
      Number of observations      10351   10351
      -----------------------------------------

      Comment

      Working...
      X