Announcement

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

  • estout with sem

    I have successfully run a sem model, and also am able to output the table of results, at least for a single model.
    I do not need to report the variance, covariances, and means of coefficients but cannot seem to drop them from the table.

    so, this works:
    estout, stats(aic bic N) cells(b(star fmt(3)) t(par fmt(2)))

    but this doesn't:
    estout, stats(aic bic N) cells(b(star fmt(3)) t(par fmt(2))) drop(_mean* _cov* _var*)

    any ideas?
    Last edited by Erin; 22 May 2014, 16:55.

  • #2
    Hi Erin,

    It seems you want to suppress some of the equations. In the user-written estout command, you can do so with drop(equation_name: ). Without the colon, it would think it is the parameter name.

    Here is an example:
    Code:
    use http://www.stata-press.com/data/r13/sem_1fmm
    
    sem (x2 x3 x4 <- X)
    eststo res
    estout res, cells(b t) unstack
    
    * to drop equations named "var(e.x2)" and "var(e.x4)"
    estout res, cells(b t) unstack drop(var(e.x2): var(e.x4):)
    
    * or use a wildcard to drop all "var(*)" equations
    estout res, cells(b t) unstack drop(var(*):)

    Here are the relevant outputs:
    Code:
    . estout res, cells(b t) unstack
    
    -------------------------------------------------------------------------------------------------------
                          res                                                                              
                           x2           x3           x4    var(e.x2)    var(e.x3)    var(e.x4)       var(X)
                          b/t          b/t          b/t          b/t          b/t          b/t          b/t
    -------------------------------------------------------------------------------------------------------
    X                       1      .873456     5.858284                                                    
                            .     9.123494     10.28549                                                    
    _cons            97.28455     97.09756     690.9837     94.99651     101.3808     342.8606     163.6298
                     67.09035     71.59739     99.27731     5.804173     6.576617     .9016638     5.021104
    -------------------------------------------------------------------------------------------------------
    
    . 
    . * to drop equations named "var(e.x2)" and "var(e.x4)"
    . estout res, cells(b t) unstack drop(var(e.x2): var(e.x4):)
    
    -----------------------------------------------------------------------------
                          res                                                    
                           x2           x3           x4    var(e.x3)       var(X)
                          b/t          b/t          b/t          b/t          b/t
    -----------------------------------------------------------------------------
    X                       1      .873456     5.858284                          
                            .     9.123494     10.28549                          
    _cons            97.28455     97.09756     690.9837     101.3808     163.6298
                     67.09035     71.59739     99.27731     6.576617     5.021104
    -----------------------------------------------------------------------------
    
    . 
    . * or use a wildcard to drop all "var(*)" equations
    . estout res, cells(b t) unstack drop(var(*):)
    
    ---------------------------------------------------
                          res                          
                           x2           x3           x4
                          b/t          b/t          b/t
    ---------------------------------------------------
    X                       1      .873456     5.858284
                            .     9.123494     10.28549
    _cons            97.28455     97.09756     690.9837
                     67.09035     71.59739     99.27731
    ---------------------------------------------------

    Comment


    • #3
      It seems the options for "estout" are not working (Stata-v.15.1):

      Code:
      use http://www.stata-press.com/data/r13/sem_1fmm, clear
      
      sem (x2 x3 x4 <- X) // Output omitted
      
      eststo res
      
      estout res, cells(b t) unstack
      
      equation / not found
      Roman

      Comment


      • #4
        Do you know of any workaround for this? I am trying to output results from several multilevel multinomial logit models (as odds ratios) and it had been working with estout, but that is no longer the case. Roman Mostazir

        Comment


        • #5
          Not sure what is the source of the problem but in my case, it is the 'unstack' option that was causing the trouble. Again not sure why!

          Code:
          use http://www.stata-press.com/data/r13/sem_1fmm, clear
          
          sem (x2 x3 x4 <- X) // Output omitted
          ------------------------------------------------------------------------------
                       |                 OIM
                       |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
          Measurement  |
            x2         |
                     X |          1  (constrained)
                 _cons |   97.28455   1.450053    67.09   0.000      94.4425    100.1266
            -----------+----------------------------------------------------------------
            x3         |
                     X |    .873456    .095737     9.12   0.000     .6858149    1.061097
                 _cons |   97.09756   1.356161    71.60   0.000     94.43953    99.75559
            -----------+----------------------------------------------------------------
            x4         |
                     X |   5.858284   .5695676    10.29   0.000     4.741951    6.974616
                 _cons |   690.9837   6.960138    99.28   0.000     677.3421    704.6254
          -------------+----------------------------------------------------------------
              var(e.x2)|   94.99651   16.36693                      67.77262    133.1561
              var(e.x3)|   101.3808   15.41534                      75.25357    136.5791
              var(e.x4)|   342.8606   380.2533                      39.00168     3014.06
                 var(X)|   163.6298   32.58842                      110.7485    241.7616
          ------------------------------------------------------------------------------
          
          
          eststo m1
          
          estout m1, cells(b t) unstack
          
          equation / not found
          
          estout m1, cells(b t)
          -------------------------
                                 m1
                                b/t
          -------------------------
          x2                       
          X                       1
                                  .
          _cons            97.28455
                           67.09035
          -------------------------
          x3                       
          X                 .873456
                           9.123494
          _cons            97.09756
                           71.59739
          -------------------------
          x4                       
          X                5.858284
                           10.28549
          _cons            690.9837
                           99.27731
          -------------------------
          /                        
          var(e.x2)        94.99651
                           5.804173
          var(e.x3)        101.3808
                           6.576617
          var(e.x4)        342.8606
                           .9016638
          var(X)           163.6298
                           5.021104
          -------------------------
          Roman

          Comment

          Working...
          X