Announcement

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

  • Multinomial Logit and estout

    I am using estout (SSC) on Stata 16.1 to tabulate the results of a multinomial logit regression. I would like to label each column with the categories that are being compared in it (i.e., Base vs. Category N). I am running the following code (as a toy example):

    Code:
    webuse auto
    qui mlogit rep78 weight length turn displacement, base(1)
    est store mlogit
    estout mlogit, stats(r2_p N, labels("Psuedo R-Squared" "N")) cells(b(star fmt(4)) se(par fmt(4))) label unstack collabels("1v1" "1v2" "1v3" "1v4" "1v5")
    Results:
    Code:
    ----------------------------------------------------------------------------------------------------
                               mlogit                                                                  
                                    1               2               3               4               5  
                                  1v1             1v1             1v1             1v1             1v1  
    ----------------------------------------------------------------------------------------------------
    Weight (lbs.)              0.0000         -0.0063         -0.0016         -0.0033         -0.0018  
                                  (.)        (0.0048)        (0.0038)        (0.0041)        (0.0049)  
    Length (in.)               0.0000          0.0850          0.0402          0.1140          0.1837  
                                  (.)        (0.1291)        (0.1060)        (0.1123)        (0.1291)  
    Turn Circle (ft.)          0.0000          0.1876         -0.3254         -0.5321         -0.6891  
                                  (.)        (0.4778)        (0.4457)        (0.4557)        (0.4838)  
    Displacement .. in.)       0.0000          0.0326          0.0216          0.0194         -0.0406  
                                  (.)        (0.0298)        (0.0274)        (0.0281)        (0.0415)  
    _cons                      0.0000         -9.9248          8.9183          8.2266          5.5910  
                                  (.)       (14.1133)       (11.7331)       (12.3532)       (13.9921)  
    ----------------------------------------------------------------------------------------------------
    Psuedo R-Squared           0.2159                                                                  
    N                         69.0000                                                                  
    ----------------------------------------------------------------------------------------------------
    I am following the syntax suggested on the estout website to specify the column labels individually, but when I do the column label repeats itself. Is there any way to work around this?

    Additionally, is there a way to avoid reporting the blank column for the reference category (first column in the example)?

    Thanks!
    Last edited by Joe Moran; 27 Jul 2022, 15:54. Reason: adding tags

  • #2
    You have only one model and the displayed results relate to equations in this model. Therefore, suppress the model labels and column labels and specify equation labels.

    Code:
    webuse auto, clear
    qui mlogit rep78 weight length turn displacement, base(1)
    estout ., stats(r2_p N, labels("Psuedo R-Squared" "N")) cells(b(star fmt(4)) se(par fmt(4))) ///
    label unstack eqlabels("1v1" "1v2" "1v3" "1v4" "1v5") collab(none) mlabels(none)
    Res.:

    Code:
    . estout ., stats(r2_p N, labels("Psuedo R-Squared" "N")) cells(b(star fmt(4)) se(par fmt(4))) label unstack collab(none) mlabels(none) eqlabels("1v1" 
    > "1v2" "1v3" "1v4" "1v5")
    
    ----------------------------------------------------------------------------------------------------
                                  1v1             1v2             1v3             1v4             1v5   
    ----------------------------------------------------------------------------------------------------
    Weight (lbs.)              0.0000         -0.0063         -0.0016         -0.0033         -0.0018   
                                  (.)        (0.0048)        (0.0038)        (0.0041)        (0.0049)   
    Length (in.)               0.0000          0.0850          0.0402          0.1140          0.1837   
                                  (.)        (0.1291)        (0.1060)        (0.1123)        (0.1291)   
    Turn Circle (ft.)          0.0000          0.1876         -0.3254         -0.5321         -0.6891   
                                  (.)        (0.4778)        (0.4457)        (0.4557)        (0.4838)   
    Displacement .. in.)       0.0000          0.0326          0.0216          0.0194         -0.0406   
                                  (.)        (0.0298)        (0.0274)        (0.0281)        (0.0415)   
    _cons                      0.0000         -9.9248          8.9183          8.2266          5.5910   
                                  (.)       (14.1133)       (11.7331)       (12.3532)       (13.9921)   
    ----------------------------------------------------------------------------------------------------
    Psuedo R-Squared           0.2159                                                                   
    N                         69.0000                                                                   
    ----------------------------------------------------------------------------------------------------

    Comment


    • #3
      Thanks, Andrew Musau ! Is there any way to suppress the column for the base category (column 1) or will that need to be done manually?

      Comment


      • #4
        Code:
        webuse auto, clear
        qui mlogit rep78 weight length turn displacement, base(1)
        estout ., stats(r2_p N, labels("Psuedo R-Squared" "N")) cells(b(star fmt(4)) se(par fmt(4))) ///
        label unstack eqlabels("1v2" "1v3" "1v4" "1v5") collab(none) mlabels(none) drop(1:)
        Res.:

        Code:
        . estout ., stats(r2_p N, labels("Psuedo R-Squared" "N")) cells(b(star fmt(4)) se(par fmt(4))) ///
        > label unstack eqlabels("1v2" "1v3" "1v4" "1v5") collab(none) mlabels(none) drop(1:)
        
        ------------------------------------------------------------------------------------
                                      1v2             1v3             1v4             1v5   
        ------------------------------------------------------------------------------------
        Weight (lbs.)             -0.0063         -0.0016         -0.0033         -0.0018   
                                 (0.0048)        (0.0038)        (0.0041)        (0.0049)   
        Length (in.)               0.0850          0.0402          0.1140          0.1837   
                                 (0.1291)        (0.1060)        (0.1123)        (0.1291)   
        Turn Circle (ft.)          0.1876         -0.3254         -0.5321         -0.6891   
                                 (0.4778)        (0.4457)        (0.4557)        (0.4838)   
        Displacement .. in.)       0.0326          0.0216          0.0194         -0.0406   
                                 (0.0298)        (0.0274)        (0.0281)        (0.0415)   
        _cons                     -9.9248          8.9183          8.2266          5.5910   
                                (14.1133)       (11.7331)       (12.3532)       (13.9921)   
        ------------------------------------------------------------------------------------
        Psuedo R-Squared           0.2159                                                   
        N                         69.0000                                                   
        ------------------------------------------------------------------------------------

        Comment


        • #5
          Hi I would really like your help Stata users.

          I want in the above code that Andrew Musau uses to report only 1v3 and 1v4. How can I do this? Andrew Musau you really helped me with your reply above.

          Also I want to generate the table in latex format. Do you know the command that I should use?
          Last edited by Panagiotis Kout; 29 Feb 2024, 06:24.

          Comment


          • #6
            See highlighted:

            Code:
            webuse auto, clear
            qui mlogit rep78 weight length turn displacement, base(1)
            esttab, tex keep(3: 4:) stats(r2_p N, labels("Psuedo R-Squared" "N")) cells(b(star fmt(4)) se(par fmt(4))) ///
            label unstack eqlabels("1v4" "1v5") collab(none) mlabels(none)
            Res.:

            Code:
            . esttab, tex keep(3: 4:) stats(r2_p N, labels("Psuedo R-Squared" "N")) cells(b(star fmt(4)) se(par fmt(4))) ///
            > label unstack eqlabels("1v3" "1v4") collab(none) mlabels(none) 
            
            {
            \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
            \begin{tabular}{l*{2}{c}}
            \hline\hline
                                &\multicolumn{1}{c}{(1)}         &                     \\
                                &         1v3         &         1v4         \\
            \hline
            Weight (lbs.)       &     -0.0016         &     -0.0033         \\
                                &    (0.0038)         &    (0.0041)         \\
            Length (in.)        &      0.0402         &      0.1140         \\
                                &    (0.1060)         &    (0.1123)         \\
            Turn circle (ft.)   &     -0.3254         &     -0.5321         \\
                                &    (0.4457)         &    (0.4557)         \\
            Displacement (cu. in.)&      0.0216         &      0.0194         \\
                                &    (0.0274)         &    (0.0281)         \\
            Constant            &      8.9183         &      8.2266         \\
                                &   (11.7331)         &   (12.3532)         \\
            \hline
            Psuedo R-Squared    &      0.2159         &                     \\
            N                   &     69.0000         &                     \\
            \hline\hline
            \end{tabular}
            }

            Comment


            • #7
              Thank you very much Andrew Musau. You are extremely helpful. I am really grateful for your help.

              Just one last question.

              I use the following code (sorry I do not know how to type the code in the code windows that you have in your post):

              eststo clear
              eststo: mlogit reaction9 PCEMP_SD_2014_19 PCDS_SD_2014_19 epssurprise epsloss_r epsdelta_r eps_r liberal conservative nonpartisan epslossliberal epslossconservative epslossnonpartisan repurchasedummyyear Productivity IRR CARES lnWC CEOAge CEODuality MBA ownership TQ cas_ho ESG CR size_2019 MTB_2019 RD_2019 lnage_2019 Fsratio_2019 CA_ratio_2019 leverage dum_2Manuf dum_3HiTec , baseoutcome(1)

              eststo: mlogit reaction9 PCEMP_SD_2014_19 PCDS_SD_2014_19 epssurprise epsloss_r epsdelta_r eps_r liberal conservative nonpartisan epslossliberal epslossconservative epslossnonpartisan repurchasedummyyear Productivity IRR CARES lnWC CEOAge CEODuality MBA ownership TQ cas_ho ESG CR size_2019 MTB_2019 RD_2019 lnage_2019 Fsratio_2019 CA_ratio_2019 leverage dum_2Manuf dum_3HiTec, baseoutcome(4)

              esttab, tex keep(3: 5 stats(r2_p N, labels("Psuedo R-Squared" "N")) cells(b(star fmt(4)) se(par fmt(4))) label unstack eqlabels("1v3" "1v5") collab(none) mlabels(none)

              The outcome is the below:

              Click image for larger version

Name:	stata outcome.png
Views:	1
Size:	67.1 KB
ID:	1745049


              What I would like to do is to keep from the first model with base(1) the option 1vs3 (the leftmost column) and for the second model with base(4) only the option 1vs5 (the rightmost column). How can I do it?

              Comment


              • #8
                The easiest way to differentiate the equations across models would be to add a constant to the DV and base, e.g., 10, ensuring that the equation numbers don't overlap. Then you can rename them in the table.

                Code:
                webuse auto, clear
                estimates clear
                eststo: qui mlogit rep78 weight length turn displacement, base(1)
                preserve
                replace rep78= rep78+10
                eststo: qui mlogit rep78 weight length turn displacement, base(14)
                restore
                esttab, tex keep(3: 15:) stats(r2_p N, labels("Psuedo R-Squared" "N")) cells(b(star fmt(4)) se(par fmt(4))) ///
                label unstack eqlabels("1v4" "1v5") collab(none) mlabels(none)
                Res.:

                Code:
                . esttab, tex keep(3: 15:) stats(r2_p N, labels("Psuedo R-Squared" "N")) cells(b(star fmt(4)) se(par fmt(4))) ///
                > label unstack eqlabels("1v4" "1v5") collab(none) mlabels(none)
                
                {
                \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
                \begin{tabular}{l*{2}{c}}
                \hline\hline
                                    &\multicolumn{1}{c}{(1)}         &\multicolumn{1}{c}{(2)}         \\
                                    &         1v4         &         1v5         \\
                \hline
                Weight (lbs.)       &     -0.0016         &      0.0014         \\
                                    &    (0.0038)         &    (0.0034)         \\
                Length (in.)        &      0.0402         &      0.0697         \\
                                    &    (0.1060)         &    (0.0822)         \\
                Turn circle (ft.)   &     -0.3254         &     -0.1570         \\
                                    &    (0.4457)         &    (0.2186)         \\
                Displacement (cu. in.)&      0.0216         &     -0.0600         \\
                                    &    (0.0274)         &    (0.0331)         \\
                Constant            &      8.9183         &     -2.6356         \\
                                    &   (11.7331)         &    (8.9348)         \\
                \hline
                Psuedo R-Squared    &      0.2159         &      0.2159         \\
                N                   &     69.0000         &     69.0000         \\
                \hline\hline
                \end{tabular}
                }

                Comment


                • #9
                  Originally posted by Panagiotis Kout View Post
                  (sorry I do not know how to type the code in the code windows that you have in your post)
                  See the Forum FAQ, #12.3.

                  Comment


                  • #10
                    Thank you very much Andrew Musau for your help!!

                    Comment

                    Working...
                    X