Announcement

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

  • Unable to use estadd with listcoef after logit and mlogit

    I've searched the web, Statalist, and helpfiles, but I'm stumped with the following problem. I'm unable to use the estadd command to append listcoef postestimation results to e() following logit and following mlogit. In both cases, I get the error "option matrix not allowed r(198); ." A check of ado dir reveals that I have spost13_ado (updated 2/10/15) and estout installed. I'm running Stata 13 MP. Any idea what the problem might be?

  • #2
    Sorry. I got an error message while posting. This is a duplicate thread. Please reply here - http://www.statalist.org/forums/foru...git-and-mlogit .

    Comment


    • #3
      Is there a fix of this problem by now?

      Comment


      • #4
        Did you check the thread that was linked to?

        http://www.statalist.org/forums/foru...git-and-mlogit
        -------------------------------------------
        Richard Williams, Notre Dame Dept of Sociology
        Stata Version: 17.0 MP (2 processor)

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

        Comment


        • #5
          Yes, I did. Thanks anyway.

          However I am not really sure what to do after
          estadd r(table). Because esttab than does not return me anything of the list coeftable. An example would be: mlogit rep78 c.price##i.foreign listcoef estadd r(table) esttab it only returns values from the mlogit, that I haven't even saved.

          Comment


          • #6
            esttab wasn't part of the original question, but yes, you often would want to use it or a similar command. My inclination would be to use matrix commands to extract the part of r(table) that you wanted (e.g. e^b) and then use estadd with that matrix.
            -------------------------------------------
            Richard Williams, Notre Dame Dept of Sociology
            Stata Version: 17.0 MP (2 processor)

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

            Comment


            • #7
              OK, you could do something like this (requires that spost13 be installed):

              Code:
              webuse nhanes2f, clear
              logit diabetes weight height
              listcoef
              mat list r(table)
              matrix table = r(table)
              matrix bStdX = table[1..2, 5]'
              estadd matrix bStdX = bStdX
              esttab , main(bStdX)
              
              . esttab , main(bStdX)
              
              ----------------------------
                                    (1)   
                               diabetes   
              ----------------------------
              diabetes                    
              weight              1.589***
                                (10.66)   
              
              height              0.633***
                                (-9.06)   
              
              _cons                    ***
                                 (3.31)   
              ----------------------------
              N                   10335   
              ----------------------------
              bStdX coefficients; t statistics in parentheses
              * p<0.05, ** p<0.01, *** p<0.001
              -------------------------------------------
              Richard Williams, Notre Dame Dept of Sociology
              Stata Version: 17.0 MP (2 processor)

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

              Comment


              • #8
                Thank you very much.

                Actually, this goes in the right direction, thanks so much.

                However, I am having a little problem and dare to ask for help again, please excuse me.


                Code:
                sysuse auto, clear
                
                gen price_cat = 1 if price <= 5000
                
                replace price_cat = 2 if inrange(price, 5001, 10000)
                
                replace price_cat = 3 if price > 10000
                
                mlogit price_cat c.length##i.foreign, baseoutcome(2)
                
                listcoef, lt
                
                mat list r(table)
                But I want longer labels for the names in the r(table) matrix and I would wish to only select the rows (every third), that contain the comparision between the groups 1 and 3.

                I am not really sure how to work with the matrices, so I really appreciate every help. Thanks so much in advance.

                Comment


                • #9
                  Hi,
                  I'm using Stata 16 and I want to present a table result that include standardized coefficients using estout command (esttab, estadd).

                  I write here because I think post # 7 is somehow related to my question.

                  Particularly, I want a table that shows y-standardized coefficient (bStdY) and fully standardized coefficient (bStdXY) for logit and probit model. Ben Jann, the autor of estout command, provides a page which give instructions to leverage its potential.

                  In the final part of "estadd" section (http://repec.sowi.unibe.ch/stata/estout/estadd.html), there is an example how to obtain a table result for 2 models that contains "y-standardized".

                  Code:
                  . capture program drop estadd_bstdy
                  . program estadd_bstdy, eclass
                  1. tempname bstdy
                  2. matrix `bstdy' = e(b)
                  3. quietly summarize `e(depvar)' if e(sample)
                  4. matrix `bstdy' = `bstdy' / r(sd)
                  5. ereturn matrix bstdy = `bstdy'
                  
                  sysuse auto
                  eststo: quietly regress price weight mpg
                  eststo: quietly regress price weight mpg foreign
                  estadd bstdy : *
                  estout, cells(b bstdy(par))
                  --------------------------------------
                                       est1 est2
                                    b/bstdy b/bstdy
                  --------------------------------------
                  weight  1.746559    3.464706
                          (.0005922)  (.0011747)
                  mpg     -49.51222   21.8536
                          (-.0167867) (.0074093)
                  foreign 3673.06
                          (1.245318)
                  _cons   1946.069    -5853.696
                          (.659797) (-1.984643)
                  --------------------------------------

                  The codes above were applied in a linear regression.
                  My goal is to compare bStdy and bStdXY coefficients from logit and probit model. The way I made some modifications to obtain standardized coefficients is:
                  Code:
                  . capture program drop estadd_bstdy
                  . program estadd_bstdy, eclass
                    1. tempname bstdy
                    2. matrix `bstdy' = e(b)
                    3. quietly summarize `e(depvar)' if e(sample)
                    4. matrix `bstdy' = `bstdy' / r(sd)
                    5. ereturn matrix bstdy = `bstdy' 
                    6. end
                  
                  . eststo stdy_logit: logit sick tp t2m ro
                  . eststo stdy_probit: probit sick tp t2m ro
                  . estadd bstdy : stdy_logit stdy_probit
                  . estout, cells(bstdy(fmt(4)))
                  --------------------------------------
                                 stdy_logit  stdy_probit
                                      bstdy        bstdy
                  --------------------------------------
                  sick                               
                  tp                 0.0011       0.0006
                  t2m                0.0030       0.0016
                  ro                 0.0007       0.0005
                  _cons             -6.3265      -3.7224
                  --------------------------------------
                  Although, the results were not as expected and were different from those obtained by listcoef command:
                  Code:
                  eststo stdy_logit: logit sick tp t2m ro
                  listcoef, std help
                  
                  eststo sstdy_probit: probit sick tp t2m ro
                  listcoef, std help

                  So my questions are what is wrong in the modified codes? How to obtain bStdY and bStdXY coefficients from logit and probit model in order to present in a table?

                  Any help will be apreciated.

                  Comment

                  Working...
                  X