Announcement

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

  • Format Table: Average Marginal Effects of Multinomial Logistic Regression

    I would like to create a table of average marginals effects estimated from a multinomial logistic regression model. I would like each outcome category (general, academic, vocation) to have its own column and SEs to be listed below the coefficients.

    The below mtable code from Spot13 works.
    Code:
    use https://stats.idre.ucla.edu/stat/data/hsbdemo, clear
    mlogit prog i.female i.ses read write 
    mtable, dydx (female) rowname(female) statistics (est se) 
     foreach var of varlist ses read write {
                   mtable, dydx (`var') rowname (`var') statistics (est se) below 
            }
    But is there another possible solution using margins, dydx(*) and estout (from SSC). Given the number of tables and variables I am working with, I was wondering if there's an easier solution than the one I found.

  • #2
    Code:
    use https://stats.idre.ucla.edu/stat/data/hsbdemo, clear
    estimates clear
    eststo mlogit: mlogit prog i.female i.ses read write 
    levelsof `e(depvar)', local(levels)
    local mlab
    foreach lev of local levels{
        est restore mlogit
        local mlab `mlab' "`:lab (`e(depvar)') `lev''"
        margins, dydx(*) predict(pr outcome(`lev')) post
        est sto est`lev'
    } 
    esttab est*, se nobaselevels mlab(`mlab') star(* 0.1 ** 0.05 *** 0.01)
    Res.:

    Code:
    . esttab est*, se nobaselevels mlab(`mlab') star(* 0.1 ** 0.05 *** 0.01)
    
    ------------------------------------------------------------
                          (1)             (2)             (3)   
                      general        academic        vocation   
    ------------------------------------------------------------
    1.female          -0.0404         -0.0139          0.0543   
                     (0.0639)        (0.0686)        (0.0599)   
    
    2.ses              -0.121         0.00578           0.115*  
                     (0.0801)        (0.0829)        (0.0659)   
    
    3.ses              -0.147*          0.175*        -0.0278   
                     (0.0893)        (0.0954)        (0.0749)   
    
    read             -0.00349          0.0113***     -0.00784** 
                    (0.00374)       (0.00391)       (0.00374)   
    
    write            0.000339          0.0104**       -0.0107***
                    (0.00392)       (0.00419)       (0.00358)   
    ------------------------------------------------------------
    N                     200             200             200   
    ------------------------------------------------------------
    Standard errors in parentheses
    * p<0.1, ** p<0.05, *** p<0.01

    Comment


    • #3
      Thank you, Andrew. This was very helpful!

      Comment

      Working...
      X