Announcement

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

  • Stata: esttab command - wrong coefficients, standard errors, stars?

    Dear Stata users,

    I am using Stata 11. I run regressions and want to generate appropriate regression tables. Therefore, I have applied Ben Jann's user-written -esttab- command.

    Yet, the regression tables (coefficients, standard errors and stars) generated by -esttab- do not correspond to the corresponding values that Stata generates and displays after -reg-. I.e. they seem to be wrong.

    Code:
    * This is my code:
     estimates clear
     reg rFRM  x1 houseage, vce(robust)
     eststo est1
     reg rFRM  x1 x2 houseage, vce(robust)
     eststo est2
     reg rFRM  x1 houseage if x3==1, vce(robust)
     eststo est3
     reg rFRM  x1 x2 houseage if x3==1, vce(robust)
     eststo est4
    
    * The -esttab- command gives a different Output, i.e. the estimated coefficients, Standard Errors and stars do not correspond to Stata Output after -reg-
     esttab est1 est2 est3 est4, se  se(3)   beta(3) label
    
     * Save the point estimates in a regression table and export the regression table.
     esttab using table_1.rtf, label replace r2(3) se(3) beta(3) brackets page line ///
      indicate("House variables = houseage") ///
      nonotes nogaps


    Has anybody incurred a similar problem? What is going on? How can I solve this issue?

    Best regards,
    Ruediger
    Last edited by ruediger.vollmeier; 23 Apr 2015, 09:05.

  • #2
    esttab est1 est2 est3 est4, se se(3) beta(3) label
    1. You provide both se and se(3). The first se does nothing in this case.
    2. The esttab table won't show any point estimates. It will show beta coefficients and standard errors. On the other hand, your regs will show point estimates but not beta coefficients. Are you confusing point estimates and beta coefficients? You might have wanted to run "esttab est1 est2 est3 est4, b(3) se(3) label".

    Comment


    • #3
      I am having the same problem, I have specified the following, but esttab is not giving me the same coefficents/results as the regression itself.

      esttab reg4 reg5 reg6 reg7 using "$output/pred2.tex", replace ///
      keep(primary junior senior ) b(3) se(3) nomtitle booktabs nonotes ///
      star(* 0.10 ** 0.05 *** 0.01) stats(N r2_a FE wife hus, fmt (0 3 0 0 0) ///
      label("Observations" "Adjusted R-Squared" "Baselines Covariates" ///
      "Wife marriage age controls" "Husband marriage age controls"))

      Comment


      • #4
        There’s not enough information in your post to help us understand what went wrong. In particular, we don’t see what reg4, reg5, reg6, or reg7 are, or what the results of those regressions are, or what the results of the esttab are. Consult the forum rules for guidance about how to post a reproducible example.

        Comment


        • #5
          Thanks for pointing that out. Here is a reproducible example. Esttab is storing the wrong point estimates, and I'm not sure why.

          Code:
          * Example generated by -dataex-. For more info, type help dataex
          clear
          input int yearmarried float(tertiary senior primary junior hus_tertiary hus_senior hus_primary hus_junior eth_bp ln_bp) int(agemarried age) float(age2 agemarried2 yearmarried2 hus_agemarried2) int hus_agemarried
          1998 . . . . . . . . 0  6.907755 15 35 1225  225 3992004  324 18
          2003 . . . . 1 1 1 1 0 4.6051702 20 35 1225  400 4012009  484 22
             . 0 0 0 0 . . . . 0         .  . 13  169    .       .    .  .
          2002 . . . . . . . . 0  5.598422 17 37 1369  289 4008004  484 22
             . . . . . . . . . 0         .  .  7   49    .       .    .  .
          1938 . . . . . . . . 0         . 16 96 9216  256 3755844    .  .
          1991 . . . . 0 0 1 0 0         . 18 45 2025  324 3964081  289 17
            .d . . . . . . . . 0         . .d 28  784    .       .    . .d
          2017 0 1 1 1 1 1 1 1 0  5.991465 22 22  484  484 4068289 1296 36
            .d . . . . . . . . 0  5.703783 .d 38 1444    .       .    . .d
          1987 0 0 1 1 . . . . 0  1.609438 23 54 2916  529 3948169    .  .
             . 0 0 1 1 . . . . 0         .  . 17  289    .       .    .  .
             . 0 0 1 1 . . . . 0         .  . 18  324    .       .    .  .
          2003 0 0 1 1 0 0 1 1 0  7.313221 21 36 1296  441 4012009  529 23
             . . . . . . . . . 0         .  .  1    1    .       .    .  .
             . 0 0 0 0 . . . . 0         .  .  9   81    .       .    .  .
          1980 0 0 1 0 . . . . 0  4.248495 20 58 3364  400 3920400    .  .
          1972 0 0 0 0 . . . . 0         . 17 63 3969  289 3888784    .  .
             . 0 0 1 1 . . . . 0         .  . 20  400    .       .    .  .
             . 0 0 0 0 . . . . 0         .  .  5   25    .       .    .  .
             . . . . . . . . . 0         .  .  9   81    .       .    .  .
             . 0 1 1 1 . . . . 0         .  . 26  676    .       .    .  .
          1976 0 0 1 1 . . . . 0 1.7917595 19 58 3364  361 3904576    .  .
             . 0 0 0 0 . . . . 0         .  . 10  100    .       .    .  .
             . . . . . . . . . 0         .  . 19  361    .       .    .  .
          1962 . . . . . . . . 0 4.1743875 21 77 5929  441 3849444  676 26
          2013 . . . . 0 0 1 0 0         . 32 37 1369 1024 4052169 1600 40
          1974 . . . . . . . . 0         . 16 56 3136  256 3896676  400 20
             . 0 0 0 0 . . . . 0         .  .  5   25    .       .    .  .
          1958 . . . . . . . . 0 3.6888795 18 66 4356  324 3833764  400 20
          end
          label values yearmarried yearmarried
          label values agemarried agemarried
          label values hus_agemarried yearofbirth


          Here is my code:


          local base yearmarried yearmarried2
          local wife agemarried agemarried2
          local hus hus_agemarried hus_agemarried2
          local husED hus_primary hus_junior hus_senior

          * Nominal Bride Price

          eststo r4: reg ln_bp primary junior senior i.ethnicity `base', r
          estadd local base "Yes"
          estadd local wife "No"
          estadd local hus "No"

          eststo r5: reg ln_bp primary junior senior i.ethnicity `base' `wife' `hus', r
          estadd local base "Yes"
          estadd local wife "Yes"
          estadd local hus "Yes"

          eststo r6: reg ln_bp primary junior senior tertiary i.ethnicity `base' `wife' `hus', r
          estadd local base "Yes"
          estadd local wife "Yes"
          estadd local hus "Yes"

          eststo r7: reg ln_bp primary junior senior i.ethnicity `husED' `base' `wife', r
          estadd local base "Yes"
          estadd local wife "Yes"
          estadd local hus "No"

          eststo r8: reg ln_bp primary junior senior i.ethnicity `husED' `base' `wife' `hus', r
          estadd local base "Yes"
          estadd local wife "Yes"
          estadd local hus "Yes"

          eststo r9: reg ln_bp primary junior senior tertiary i.ethnicity `husED' ///
          hus_tertiary `base' `wife' `hus', r
          estadd local base "Yes"
          estadd local wife "Yes"
          estadd local hus "Yes"

          esttab r4 r5 r6 r7 r8 r9 using "$output/pred2.tex", replace b(3) se(3) ///
          nomtitle booktabs nonotes keep(primary junior senior tertiary `husED' hus_tertiary) ///
          star(* 0.10 ** 0.05 *** 0.01) stats(N r2_a base wife hus, fmt (0 3 0 0 0) ///
          label("Observations" "Adjusted R-Squared" "Baselines Covariates" ///
          "Wife marriage age controls" "Husband marriage age controls"))

          Comment


          • #6
            This is a lot better, thanks. I am unable to reproduce your issue.

            Your data example does not include the variable "ethnicity", so I replaced "i.ethnicity" in the regressions with "i.eth_bp".

            Here are my results for r4.

            Code:
            . eststo r4: reg ln_bp primary junior senior i.eth_bp `base', r
            note: primary omitted because of collinearity.
            note: 0.eth_bp omitted because of collinearity.
            
            Linear regression                               Number of obs     =          5
                                                            F(0, 0)           =          .
                                                            Prob > F          =          .
                                                            R-squared         =     1.0000
                                                            Root MSE          =          0
            
            ------------------------------------------------------------------------------
                         |               Robust
                   ln_bp | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
            -------------+----------------------------------------------------------------
                 primary |          0  (omitted)
                  junior |  -2.909913          .        .       .            .           .
                  senior |  -12.11574          .        .       .            .           .
                0.eth_bp |          0  (omitted)
             yearmarried |  -54.77366          .        .       .            .           .
            yearmarried2 |   .0138171          .        .       .            .           .
                   _cons |   54287.62          .        .       .            .           .
            ------------------------------------------------------------------------------
            And here it is in esttab, as column 1. (I removed the booktabs option and the output file to make it easier to read in the Stata results window.)

            Code:
            . esttab r4 r5 r6 r7 r8 r9, replace b(3) se(3) ///
            > nomtitle nonotes keep(primary junior senior tertiary `husED' hus_tertiary) ///
            > star(* 0.10 ** 0.05 *** 0.01) stats(N r2_a base wife hus, fmt (0 3 0 0 0) ///
            > label("Observations" "Adjusted R-Squared" "Baselines Covariates" ///
            > "Wife marriage age controls" "Husband marriage age controls"))
            
            ------------------------------------------------------------------------------------------------------------
                                  (1)             (2)             (3)             (4)             (5)             (6)   
            ------------------------------------------------------------------------------------------------------------
            primary             0.000           0.000           0.000           0.000           0.000           0.000   
                                  (.)             (.)             (.)             (.)             (.)             (.)   
            
            junior             -2.910           0.000           0.000           0.000           0.000           0.000   
                                  (.)             (.)             (.)             (.)             (.)             (.)   
            
            senior            -12.116          -1.322          -1.322          -1.322          -1.322          -1.322   
                                  (.)             (.)             (.)             (.)             (.)             (.)   
            
            tertiary                                            0.000                                           0.000   
                                                                  (.)                                             (.)   
            
            hus_primary                                                         0.000           0.000           0.000   
                                                                                  (.)             (.)             (.)   
            
            hus_junior                                                          0.000           0.000           0.000   
                                                                                  (.)             (.)             (.)   
            
            hus_senior                                                          0.000           0.000           0.000   
                                                                                  (.)             (.)             (.)   
            
            hus_tertiary                                                                                        0.000   
                                                                                                                  (.)   
            ------------------------------------------------------------------------------------------------------------
            Observations            5               2               2               2               2               2   
            Adjusted R~d            .               .               .               .               .               .   
            Baselines ~s          Yes             Yes             Yes             Yes             Yes             Yes   
            Wife marri~s           No             Yes             Yes             Yes             Yes             Yes   
            Husband ma~s           No             Yes             Yes              No             Yes             Yes   
            ------------------------------------------------------------------------------------------------------------
            Can you post a fully reproducible example (e.g. with "ethnicity" present) that demonstrates the issue, together with the results you get when running the example?

            Comment


            • #7
              Data example:

              Code:
              * Example generated by -dataex-. For more info, type help dataex
              clear
              input float(tertiary senior primary junior hus_tertiary hus_senior hus_primary hus_junior eth_bp ln_bp) int(agemarried age) float(age2 agemarried2 yearmarried2 hus_agemarried2) int(hus_agemarried ethnicity)
              . . . . 1 1 1 1 0 4.6051702 20 35 1225 400 4012009  484 22 93
              0 0 1 1 0 1 1 1 0  3.912023 25 72 5184 625 3880900  676 26 93
              0 0 0 0 . . . . 0         .  . 12  144   .       .    .  . 93
              0 0 0 0 . . . . 0         .  . 12  144   .       .    .  . 93
              . . . . . . . . 0         .  .  3    9   .       .    .  . 93
              0 0 1 0 . . . . 0         .  . 14  196   .       .    .  . 93
              0 0 0 0 . . . . 0         .  .  6   36   .       .    .  . 93
              . . . . . . . . 0         .  .  5   25   .       .    .  . 93
              0 0 0 0 . . . . 0         .  .  5   25   .       .    .  . 93
              0 0 0 0 . . . . 0         .  . 11  121   .       .    .  . 93
              0 0 1 0 . . . . 0         . .d 77 5929   .       .    .  . 93
              . . . . . . . . 0  3.912023 20 52 2704 400 3944196    .  . 93
              . . . . . . . . 0         . 20 61 3721 400 3924361    .  . 93
              . . . . 0 0 0 0 0   6.39693 14 34 1156 196 3992004  256 16 93
              0 1 1 1 . . . . 0         .  . 22  484   .       .    .  . 93
              . . . . . . . . 0  5.991465 20 58 3364 400 3920400    .  . 93
              0 0 0 0 . . . . 0         .  . 17  289   .       .    .  . 93
              0 0 0 0 . . . . 0         .  .  8   64   .       .    .  . 93
              . . . . . . . . 0 4.6051702 .d 60 3600   .       . 1225 35 93
              . . . . . . . . 0         .  .  1    1   .       .    .  . 93
              0 0 0 0 . . . . 0         .  .  9   81   .       .    .  . 93
              0 0 1 0 . . . . 0         .  . 14  196   .       .    .  . 93
              0 0 0 0 . . . . 0         .  . 14  196   .       .    .  . 93
              0 0 0 0 . . . . 0         .  . 12  144   .       .    .  . 93
              . . . . . . . . 0         .  .  1    1   .       .    .  . 93
              0 0 0 0 0 0 1 0 0  7.313221 20 32 1024 400 4040100  841 29 93
              . . . . 0 0 1 0 0         . 15 58 3364 225 3900625  289 17 93
              . . . . . . . . 0  3.912023 18 37 1369 324 3992004    . .d 93
              0 0 1 0 . . . . 0         .  . 17  289   .       .    .  . 93
              . . . . . . . . 0  5.703783 .d 38 1444   .       .    . .d 93
              0 0 0 0 . . . . 0  2.995732 18 64 4096 324 3888784 1600 40 93
              0 0 1 0 . . . . 0         .  . 19  361   .       .    .  . .d
              0 0 1 1 . . . . 0         .  . 17  289   .       .    .  . 93
              0 0 1 0 . . . . 0         .  . 12  144   .       .    .  . 93
              0 0 0 0 . . . . 0         .  .  8   64   .       .    .  . .d
              0 0 1 0 . . . . 0         .  . 21  441   .       .    .  . 93
              . . . . . . . . 0         .  .  0    0   .       .    .  . 93
              . . . . . . . . 0 3.6888795 18 66 4356 324 3833764  400 20 93
              0 0 0 0 . . . . 0         .  . 10  100   .       .    .  . 93
              . . . . . . . . 0  .6931472 .d 53 2809   .       .  484 22 93
              end
              label values agemarried agemarried
              label values hus_agemarried yearofbirth
              label values ethnicity ethnicity

              My code:

              Code:
                  local base yearmarried yearmarried2
                  local wife agemarried agemarried2
                  local hus hus_agemarried hus_agemarried2
                  local husED hus_primary hus_junior hus_senior
              
              * Nominal Bride Price   
              
              eststo r4: reg ln_bp primary junior senior i.ethnicity `base', r
                  estadd local  base "Yes"
                  estadd local  wife "No"
                  estadd local  hus  "No"
              
              eststo r5: reg ln_bp primary junior senior i.ethnicity `base' `wife' `hus', r
                  estadd local  base "Yes"
                  estadd local  wife "Yes"
                  estadd local  hus  "Yes"
                  
              eststo r6: reg ln_bp primary junior senior tertiary i.ethnicity `base' `wife' `hus', r
                  estadd local  base "Yes"
                  estadd local  wife "Yes"
                  estadd local  hus  "Yes"
                          
              eststo r7: reg ln_bp primary junior senior i.ethnicity `husED' `base' `wife', r
                  estadd local  base "Yes"
                  estadd local  wife "Yes"
                  estadd local  hus  "No"
                          
              eststo r8: reg ln_bp primary junior senior i.ethnicity `husED' `base' `wife' `hus', r
                  estadd local  base "Yes"
                  estadd local  wife "Yes"
                  estadd local  hus  "Yes"
              
              eststo r9: reg ln_bp primary junior senior tertiary i.ethnicity `husED' ///
                  hus_tertiary `base' `wife' `hus', r
                  estadd local  base "Yes"
                  estadd local  wife "Yes"
                  estadd local  hus  "Yes"
                  
              esttab r4 r5 r6 r7 r8 r9 using "$output/pred2.tex", replace b(3) se(3) ///
                  nomtitle booktabs nonotes keep(primary junior senior tertiary `husED' hus_tertiary) ///
                  star(* 0.10 ** 0.05 *** 0.01) stats(N r2_a base wife hus, fmt (0 3 0 0 0) ///
                  label("Observations" "Adjusted R-Squared" "Baselines Covariates" ///
                  "Wife marriage age controls" "Husband marriage age controls"))

              Esttab Output :
              ------------------------------------------------------------------------------------------------------------
              (1) (2) (3) (4) (5) (6)
              ------------------------------------------------------------------------------------------------------------
              primary -0.340* -0.483* -0.482* -0.424 -0.424 -0.420
              (0.198) (0.267) (0.267) (0.288) (0.290) (0.291)

              junior 0.423** 0.629*** 0.634*** 0.537** 0.556** 0.564**
              (0.166) (0.216) (0.216) (0.228) (0.228) (0.228)

              senior 0.032 -0.023 -0.359 -0.248 -0.258 -0.511
              (0.199) (0.266) (0.336) (0.283) (0.282) (0.351)

              tertiary 0.817** 0.669
              (0.410) (0.422)

              hus_tertiary -0.185
              (0.246)
              ------------------------------------------------------------------------------------------------------------
              Observations 1517 943 943 878 871 871
              Adjusted R~d 0.291 0.240 0.242 0.251 0.247 0.248
              Baselines ~s Yes Yes Yes Yes Yes Yes
              Wife marri~s No Yes Yes Yes Yes Yes
              Husband ma~s No Yes Yes No Yes Yes
              ------------------------------------------------------------------------------------------------------------

              .

              Comment


              • #8
                This code still doesn't reproduce. For example, this is what I get for r4.

                Code:
                . eststo r4: reg ln_bp primary junior senior i.ethnicity `base', r
                note: junior omitted because of collinearity.
                note: senior omitted because of collinearity.
                note: 93.ethnicity omitted because of collinearity.
                note: yearmarried2 omitted because of collinearity.
                
                Linear regression                               Number of obs     =          3
                                                                F(0, 0)           =          .
                                                                Prob > F          =          .
                                                                R-squared         =     1.0000
                                                                Root MSE          =          0
                
                ------------------------------------------------------------------------------
                             |               Robust
                       ln_bp | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
                -------------+----------------------------------------------------------------
                     primary |   1.141245          .        .       .            .           .
                      junior |          0  (omitted)
                      senior |          0  (omitted)
                93.ethnicity |          0  (omitted)
                yearmarried2 |   .0000285          .        .       .            .           .
                yearmarried2 |          0  (omitted)
                       _cons |  -107.9627          .        .       .            .           .
                ------------------------------------------------------------------------------
                I think you are probably running esttab on your full dataset, rather than on the example data you provided. Please post a fully reproducible example, so that you and I are looking at exactly the same code and results. Your results don't need to be your actual analysis results; they just need to demonstrate the issue that you see.

                There is one other issue with the example you provided. You use the variable "yearmarried", but that variable is not in your dataset. It's possible that the reason this didn't show up for you is because you have variable abbreviation turned on, and Stata was interpreting "yearmarried" as "yearmarried2". See "help set varabbrev" for more. (It's also possible that you do actually have a "yearmarried" variable, but it isn't in your example.)

                Comment


                • #9
                  Here, this should do it. Thanks.

                  example:
                  Code:
                  clear
                  input int yearmarried float yearmarried2 int agemarried float agemarried2 int hus_agemarried float(hus_agemarried2 hus_primary hus_junior hus_senior ln_bp primary junior senior tertiary) int ethnicity float hus_tertiary
                     .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                  2015 4060225 15 225 20  400 0 0 0  6.214608 . . . . 93 0
                     .       .  .   .  .    . . . .         . 1 1 0 0 93 .
                  2011 4044121 28 784  .    . . . .   6.39693 1 0 0 0 93 .
                  2012 4048144 19 361 25  625 0 0 0         . 1 0 0 0 93 0
                    .d       . .d   .  .    . . . .         . . . . . 93 .
                  1983 3932289 20 400  .    . . . .         . . . . . 93 .
                     .       .  .   .  .    . . . .         . 1 1 0 0 93 .
                  2002 4008004 19 361 25  625 . . . 4.6051702 . . . . 93 .
                    .d       . .d   .  .    . . . .         . . . . . 93 .
                     .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                  1965 3861225 15 225 17  289 . . .  2.995732 . . . . 93 .
                     .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                  1985 3940225 16 256 32 1024 . . . 1.0986123 . . . . 93 .
                     .       .  .   .  .    . . . .         . . . . . 93 .
                     .       .  .   .  .    . . . .         . . . . . 93 .
                     .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                     .       .  .   .  .    . . . .         . . . . . 93 .
                  1979 3916441 24 576  .    . . . .         . . . . . 93 .
                  2003 4012009 21 441 34 1156 0 0 0  1.609438 0 0 0 0 93 0
                  2008 4032064 25 625  .    . . . .         . 0 0 0 0 93 .
                     .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                  2014 4056196 20 400 32 1024 1 1 1  7.600903 1 0 0 0 93 0
                     .       .  .   .  .    . . . .         . 1 1 0 0 93 .
                     .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                     .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                     .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                  2006 4024036 22 484 26  676 . . .  7.600903 . . . . 93 .
                  2006 4024036 18 324 21  441 . . .         . . . . . 93 .
                     .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                     .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                  1999 3996001 26 676 27  729 0 0 0 2.0794415 . . . . 93 0
                  1994 3976036 20 400  .    . . . .         . . . . . 93 .
                     .       .  .   .  .    . . . .         . 1 0 0 0 93 .
                     .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                     .       .  .   .  .    . . . .         . 1 1 0 0 93 .
                     .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                     .       .  .   .  .    . . . .         . 1 1 1 0 93 .
                     .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                  1979 3916441 20 400  .    . . . .  .8754688 . . . . 93 .
                  end
                  label values yearmarried yearmarried
                  label values agemarried agemarried
                  label values hus_agemarried yearofbirth
                  label values ethnicity ethnicity
                  my code:
                  Code:
                      local base yearmarried yearmarried2
                      local wife agemarried agemarried2
                      local hus hus_agemarried hus_agemarried2
                      local husED hus_primary hus_junior hus_senior
                  
                  * Nominal Bride Price, husband's report  
                  
                  eststo b1: reg ln_bp primary junior senior i.ethnicity `base', r
                      estadd local  base "Yes"
                      estadd local  wife "No"
                      estadd local  hus  "No"
                  
                  eststo b2: reg ln_bp primary junior senior i.ethnicity `base' `wife' `hus', r
                      estadd local  base "Yes"
                      estadd local  wife "Yes"
                      estadd local  hus  "Yes"
                      
                  eststo b3: reg ln_bp primary junior senior tertiary i.ethnicity `base' `wife' `hus', r
                      estadd local  base "Yes"
                      estadd local  wife "Yes"
                      estadd local  hus  "Yes"
                              
                  eststo b4: reg ln_bp primary junior senior i.ethnicity `husED' `base' `wife', r
                      estadd local  base "Yes"
                      estadd local  wife "Yes"
                      estadd local  hus  "No"
                              
                  eststo b5: reg ln_bp primary junior senior i.ethnicity `husED' `base' `wife' `hus', r
                      estadd local  base "Yes"
                      estadd local  wife "Yes"
                      estadd local  hus  "Yes"
                  
                  eststo b6: reg ln_bp primary junior senior tertiary i.ethnicity `husED' ///
                      hus_tertiary `base' `wife' `hus', r
                      estadd local  base "Yes"
                      estadd local  wife "Yes"
                      estadd local  hus  "Yes"
                      
                  esttab b1 b2 b3 b4 b5 b6 , replace b(3) se(3) ///
                      nomtitle  nonotes keep(primary junior senior tertiary `husED' hus_tertiary) ///
                      star(* 0.10 ** 0.05 *** 0.01) stats(N base wife hus r2_a, fmt (0 0 0 0 3) ///
                      label("Observations" "Baselines Covariates" "Wife marriage age controls" ///
                      "Husband marriage age controls" "Adjusted R-Squared" ))

                  Output:
                  ------------------------------------------------------------------------------------------------------------
                  (1) (2) (3) (4) (5) (6)
                  ------------------------------------------------------------------------------------------------------------
                  primary 1.577 5.991 5.991 5.991 5.991 5.991
                  (.) (.) (.) (.) (.) (.)

                  junior 0.000 0.000 0.000 0.000 0.000 0.000
                  (.) (.) (.) (.) (.) (.)

                  senior 0.000 0.000 0.000 0.000 0.000 0.000
                  (.) (.) (.) (.) (.) (.)

                  tertiary 0.000 0.000
                  (.) (.)

                  hus_tertiary 0.000
                  (.)
                  ------------------------------------------------------------------------------------------------------------
                  Observations 3 2 2 2 2 2
                  Baselines ~s Yes Yes Yes Yes Yes Yes
                  Wife marri~s No Yes Yes Yes Yes Yes
                  Husband ma~s No Yes Yes No Yes Yes
                  Adjusted R~d . . . . . .
                  ------------------------------------------------------------------------------------------------------------



                  Comment


                  • #10
                    Thanks. You have not included the results from the regressions, just the result from esttab. I can replicate your results from esttab. You said "esttab is not giving me the same coefficents/results as the regression itself". Can you show us the coefficients/results of the regressions themselves? They look identical to me. For example, I get this for b1:

                    Code:
                    . eststo b1: reg ln_bp primary junior senior i.ethnicity `base', r
                    note: junior omitted because of collinearity.
                    note: senior omitted because of collinearity.
                    note: 93.ethnicity omitted because of collinearity.
                    note: yearmarried2 omitted because of collinearity.
                    
                    Linear regression                               Number of obs     =          3
                                                                    F(0, 0)           =          .
                                                                    Prob > F          =          .
                                                                    R-squared         =     1.0000
                                                                    Root MSE          =          0
                    
                    ------------------------------------------------------------------------------
                                 |               Robust
                           ln_bp | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
                    -------------+----------------------------------------------------------------
                         primary |   1.576898          .        .       .            .           .
                          junior |          0  (omitted)
                          senior |          0  (omitted)
                    93.ethnicity |          0  (omitted)
                     yearmarried |   .4013243          .        .       .            .           .
                    yearmarried2 |          0  (omitted)
                           _cons |  -802.2431          .        .       .            .           .
                    ------------------------------------------------------------------------------

                    Comment


                    • #11
                      What is happening a lot is that for the same set of regressions, esttab stores and displays a different set of estimates each time.

                      My output for reg b2:
                      Code:
                      . eststo b2: reg ln_bp primary junior senior i.ethnicity `base' `wife' `hus', r
                      note: junior omitted because of collinearity.
                      note: senior omitted because of collinearity.
                      note: 93.ethnicity omitted because of collinearity.
                      
                      Linear regression                               Number of obs     =          3
                                                                      F(1, 1)           =      53.44
                                                                      Prob > F          =     0.0866
                                                                      R-squared         =     0.9639
                                                                      Root MSE          =     .85134
                      
                      ------------------------------------------------------------------------------
                                   |               Robust
                             ln_bp | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
                      -------------+----------------------------------------------------------------
                           primary |   5.389479   .7372798     7.31   0.087    -3.978549    14.75751
                            junior |          0  (omitted)
                            senior |          0  (omitted)
                      93.ethnicity |          0  (omitted)
                             _cons |   1.609438          .        .       .            .           .
                      ------------------------------------------------------------------------------
                      reg b4:
                      Code:
                      . eststo b4: reg ln_bp primary junior senior i.ethnicity `husED' `base' `wife', r
                      note: junior omitted because of collinearity.
                      note: senior omitted because of collinearity.
                      note: 93.ethnicity omitted because of collinearity.
                      
                      Linear regression                               Number of obs     =          3
                                                                      F(1, 1)           =      53.44
                                                                      Prob > F          =     0.0866
                                                                      R-squared         =     0.9639
                                                                      Root MSE          =     .85134
                      
                      ------------------------------------------------------------------------------
                                   |               Robust
                             ln_bp | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
                      -------------+----------------------------------------------------------------
                           primary |   5.389479   .7372798     7.31   0.087    -3.978549    14.75751
                            junior |          0  (omitted)
                            senior |          0  (omitted)
                      93.ethnicity |          0  (omitted)
                             _cons |   1.609438          .        .       .            .           .
                      ------------------------------------------------------------------------------

                      Comment


                      • #12
                        Notice that in your b2 regression, you don't have coefficients for yearmarried, yearmarried2, agemarried, agemarried2, hus_agemarried, or hus_agemarried2. And it's not just that they're omitted for collinearity -- you can see that these variables aren't mentioned at all. But you expected them to be there, because you included `base' `wife' `hus'. The issue is that in the regressions above -- the ones in comment #11 -- your local macros are empty.

                        My guess is that you ran your code as a do-file, and it worked properly, though you didn't realize it. Then you copied and pasted some of the regressions into the command window, and you saw different results. But that's because your local macros weren't set anymore when you ran these regressions, so not all the intended variables entered the regression. The local macros ceased to exist outside the context of the do-file, as intended. I'm not sure that's exactly what's going on, but I'm sure it's something along those lines.

                        For example, I ran this code from the do-file editor:
                        Code:
                        clear
                        input int yearmarried float yearmarried2 int agemarried float agemarried2 int hus_agemarried float(hus_agemarried2 hus_primary hus_junior hus_senior ln_bp primary junior senior tertiary) int ethnicity float hus_tertiary
                           .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                        2015 4060225 15 225 20  400 0 0 0  6.214608 . . . . 93 0
                           .       .  .   .  .    . . . .         . 1 1 0 0 93 .
                        2011 4044121 28 784  .    . . . .   6.39693 1 0 0 0 93 .
                        2012 4048144 19 361 25  625 0 0 0         . 1 0 0 0 93 0
                          .d       . .d   .  .    . . . .         . . . . . 93 .
                        1983 3932289 20 400  .    . . . .         . . . . . 93 .
                           .       .  .   .  .    . . . .         . 1 1 0 0 93 .
                        2002 4008004 19 361 25  625 . . . 4.6051702 . . . . 93 .
                          .d       . .d   .  .    . . . .         . . . . . 93 .
                           .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                        1965 3861225 15 225 17  289 . . .  2.995732 . . . . 93 .
                           .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                        1985 3940225 16 256 32 1024 . . . 1.0986123 . . . . 93 .
                           .       .  .   .  .    . . . .         . . . . . 93 .
                           .       .  .   .  .    . . . .         . . . . . 93 .
                           .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                           .       .  .   .  .    . . . .         . . . . . 93 .
                        1979 3916441 24 576  .    . . . .         . . . . . 93 .
                        2003 4012009 21 441 34 1156 0 0 0  1.609438 0 0 0 0 93 0
                        2008 4032064 25 625  .    . . . .         . 0 0 0 0 93 .
                           .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                        2014 4056196 20 400 32 1024 1 1 1  7.600903 1 0 0 0 93 0
                           .       .  .   .  .    . . . .         . 1 1 0 0 93 .
                           .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                           .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                           .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                        2006 4024036 22 484 26  676 . . .  7.600903 . . . . 93 .
                        2006 4024036 18 324 21  441 . . .         . . . . . 93 .
                           .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                           .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                        1999 3996001 26 676 27  729 0 0 0 2.0794415 . . . . 93 0
                        1994 3976036 20 400  .    . . . .         . . . . . 93 .
                           .       .  .   .  .    . . . .         . 1 0 0 0 93 .
                           .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                           .       .  .   .  .    . . . .         . 1 1 0 0 93 .
                           .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                           .       .  .   .  .    . . . .         . 1 1 1 0 93 .
                           .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                        1979 3916441 20 400  .    . . . .  .8754688 . . . . 93 .
                        end
                        label values yearmarried yearmarried
                        label values agemarried agemarried
                        label values hus_agemarried yearofbirth
                        label values ethnicity ethnicity
                        
                        local base yearmarried yearmarried2
                        local wife agemarried agemarried2
                        local hus hus_agemarried hus_agemarried2
                        local husED hus_primary hus_junior hus_senior
                        
                        * Nominal Bride Price, husband's report  
                        
                        eststo b1: reg ln_bp primary junior senior i.ethnicity `base', r
                        And I got these results:
                        Code:
                        . input int yearmarried float yearmarried2 int agemarried float agemarried2 int hus_agemarried float(hus_agemarried2 hus_primary hu
                        > s_junior hus_senior ln_bp primary junior senior tertiary) int ethnicity float hus_tertiary
                        
                             yearma~d  yearmar~2  agemar~d  agemarr~2  hus_ag~d  hus_age~2  hus_pri~y  hus_jun~r  hus_sen~r      ln_bp    primary     junio
                        > r     senior   tertiary  ethnic~y  hus_ter~y
                          1.    .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                          2. 2015 4060225 15 225 20  400 0 0 0  6.214608 . . . . 93 0
                          3.    .       .  .   .  .    . . . .         . 1 1 0 0 93 .
                          4. 2011 4044121 28 784  .    . . . .   6.39693 1 0 0 0 93 .
                          5. 2012 4048144 19 361 25  625 0 0 0         . 1 0 0 0 93 0
                          6.   .d       . .d   .  .    . . . .         . . . . . 93 .
                          7. 1983 3932289 20 400  .    . . . .         . . . . . 93 .
                          8.    .       .  .   .  .    . . . .         . 1 1 0 0 93 .
                          9. 2002 4008004 19 361 25  625 . . . 4.6051702 . . . . 93 .
                         10.   .d       . .d   .  .    . . . .         . . . . . 93 .
                         11.    .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                         12. 1965 3861225 15 225 17  289 . . .  2.995732 . . . . 93 .
                         13.    .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                         14. 1985 3940225 16 256 32 1024 . . . 1.0986123 . . . . 93 .
                         15.    .       .  .   .  .    . . . .         . . . . . 93 .
                         16.    .       .  .   .  .    . . . .         . . . . . 93 .
                         17.    .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                         18.    .       .  .   .  .    . . . .         . . . . . 93 .
                         19. 1979 3916441 24 576  .    . . . .         . . . . . 93 .
                         20. 2003 4012009 21 441 34 1156 0 0 0  1.609438 0 0 0 0 93 0
                         21. 2008 4032064 25 625  .    . . . .         . 0 0 0 0 93 .
                         22.    .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                         23. 2014 4056196 20 400 32 1024 1 1 1  7.600903 1 0 0 0 93 0
                         24.    .       .  .   .  .    . . . .         . 1 1 0 0 93 .
                         25.    .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                         26.    .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                         27.    .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                         28. 2006 4024036 22 484 26  676 . . .  7.600903 . . . . 93 .
                         29. 2006 4024036 18 324 21  441 . . .         . . . . . 93 .
                         30.    .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                         31.    .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                         32. 1999 3996001 26 676 27  729 0 0 0 2.0794415 . . . . 93 0
                         33. 1994 3976036 20 400  .    . . . .         . . . . . 93 .
                         34.    .       .  .   .  .    . . . .         . 1 0 0 0 93 .
                         35.    .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                         36.    .       .  .   .  .    . . . .         . 1 1 0 0 93 .
                         37.    .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                         38.    .       .  .   .  .    . . . .         . 1 1 1 0 93 .
                         39.    .       .  .   .  .    . . . .         . 0 0 0 0 93 .
                         40. 1979 3916441 20 400  .    . . . .  .8754688 . . . . 93 .
                         41. end
                        
                        . label values yearmarried yearmarried
                        
                        . label values agemarried agemarried
                        
                        . label values hus_agemarried yearofbirth
                        
                        . label values ethnicity ethnicity
                        
                        .
                        . local base yearmarried yearmarried2
                        
                        . local wife agemarried agemarried2
                        
                        . local hus hus_agemarried hus_agemarried2
                        
                        . local husED hus_primary hus_junior hus_senior
                        
                        .
                        . * Nominal Bride Price, husband's report  
                        .
                        . eststo b1: reg ln_bp primary junior senior i.ethnicity `base', r
                        note: junior omitted because of collinearity.
                        note: senior omitted because of collinearity.
                        note: 93.ethnicity omitted because of collinearity.
                        note: yearmarried2 omitted because of collinearity.
                        
                        Linear regression                               Number of obs     =          3
                                                                        F(0, 0)           =          .
                                                                        Prob > F          =          .
                                                                        R-squared         =     1.0000
                                                                        Root MSE          =          0
                        
                        ------------------------------------------------------------------------------
                                     |               Robust
                               ln_bp | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
                        -------------+----------------------------------------------------------------
                             primary |   1.576898          .        .       .            .           .
                              junior |          0  (omitted)
                              senior |          0  (omitted)
                        93.ethnicity |          0  (omitted)
                         yearmarried |   .4013243          .        .       .            .           .
                        yearmarried2 |          0  (omitted)
                               _cons |  -802.2431          .        .       .            .           .
                        ------------------------------------------------------------------------------
                        
                        .
                        end of do-file
                        Then I immediately ran in the command window
                        Code:
                        eststo b1: reg ln_bp primary junior senior i.ethnicity `base', r
                        And I got these different results:
                        Code:
                        . eststo b1: reg ln_bp primary junior senior i.ethnicity `base', r
                        note: junior omitted because of collinearity.
                        note: senior omitted because of collinearity.
                        note: 93.ethnicity omitted because of collinearity.
                        
                        Linear regression                               Number of obs     =          3
                                                                        F(1, 1)           =      53.44
                                                                        Prob > F          =     0.0866
                                                                        R-squared         =     0.9639
                                                                        Root MSE          =     .85134
                        
                        ------------------------------------------------------------------------------
                                     |               Robust
                               ln_bp | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
                        -------------+----------------------------------------------------------------
                             primary |   5.389479   .7372798     7.31   0.087    -3.978549    14.75751
                              junior |          0  (omitted)
                              senior |          0  (omitted)
                        93.ethnicity |          0  (omitted)
                               _cons |   1.609438          .        .       .            .           .
                        ------------------------------------------------------------------------------
                        .
                        Last edited by Nils Enevoldsen; 24 Apr 2023, 22:22.

                        Comment


                        • #13
                          Dear all,

                          I have the same problem that was posted 8 years ago.

                          I am recreating a paper by Bauer et al. (2012). My probit regressions yield the same results as given in their paper, however, when I try to create a table the numbers don't match. The number are actually not even appearing in the regression table so I do not know where they come from.

                          The probit regression I run is:
                          Code:
                          xi: dprobit shg_part pb_strong pb_weak dr_current pat_cur_impat_fut  i.risk  female edu age age_sq married    hh_head wealth        income   farmer shock i.village position position_sq if female==1
                          I then store the results with:
                          Code:
                          estimates store Model1

                          The output is given as:
                          Code:
                          Probit regression, reporting marginal effects           Number of obs =    239
                                                                                  LR chi2(36)   = 110.81
                                                                                  Prob > chi2   = 0.0000
                          Log likelihood = -100.73829                             Pseudo R2     = 0.3548
                          
                          ------------------------------------------------------------------------------
                          shg_part |      dF/dx   Std. Err.      z    P>|z|     x-bar  [    95% C.I.   ]
                          ---------+--------------------------------------------------------------------
                          pb_str~g*|    .276505    .073158     2.93   0.003   .209205   .133118  .419892
                           pb_weak*|  -.0461041   .1250408    -0.38   0.707   .133891   -.29118  .198971
                          dr_cur~t |  -.9107635   .2390528    -3.81   0.000   .228159   -1.3793 -.442229
                          pat_cu~t*|   -.074818   .1402011    -0.55   0.582   .087866  -.349607  .199971
                          _Irisk_2*|  -.2197179   .2033449    -1.12   0.263   .100418  -.618267  .178831
                          _Irisk_3*|  -.0119257   .1516904    -0.08   0.937   .292887  -.309233  .285382
                          _Irisk_4*|  -.4525247    .167696    -2.49   0.013   .175732  -.781203 -.123847
                          _Irisk_5*|  -.2570856   .1799258    -1.46   0.143   .167364  -.609734  .095562
                          _Irisk_6*|  -.0616369   .1802994    -0.35   0.726   .175732  -.415017  .291743
                               edu |  -.0192026    .013386    -1.43   0.152   3.47699  -.045439  .007033
                               age |   .0923757   .0262032     3.48   0.000    36.046   .041018  .143733
                            age_sq |  -.0011418   .0003245    -3.48   0.001   1428.09  -.001778 -.000506
                           married*|   .2007608   .1772503     1.17   0.241   .794979  -.146643  .548165
                           hh_head*|  -.0480614   .1847716    -0.27   0.790   .112971  -.410207  .314084
                            wealth |   .0325221   .0267862     1.21   0.226  -.076025  -.019978  .085022
                            income*|   .0015377    .081637     0.02   0.985   .497908  -.158468  .161543
                            farmer*|   .1300459   .1020542     1.29   0.196   .656904  -.069977  .330068
                             shock*|   .0265324   .0958322     0.28   0.783   .384937  -.161295   .21436
                          _Ivil~_2*|    .319174   .0664442     1.87   0.061   .066946   .188946  .449402
                          _Ivil~_3*|    .150653   .1738505     0.72   0.470   .054393  -.190088  .491394
                          _Ivil~_4*|  -.4665207   .1910042    -2.10   0.036   .062762  -.840882 -.092159
                          _Ivil~_5*|  -.1488049   .2216839    -0.70   0.484   .079498  -.583297  .285688
                          _Ivil~_6*|  -.0552932   .2318688    -0.25   0.806   .046025  -.509748  .399161
                          _Ivil~_7*|  -.0455794   .2239636    -0.21   0.835   .054393   -.48454  .393381
                          _Ivil~_8*|   .0453064   .2064584     0.21   0.832   .062762  -.359345  .449957
                          _Ivill~9*|  -.5927123   .1553765    -2.53   0.011    .07113  -.897245  -.28818
                          _Ivil~10*|   .1980511   .1554258     0.94   0.346   .050209  -.106578   .50268
                          _Ivil~11*|   .1427328   .1827854     0.67   0.505    .07113   -.21552  .500986
                          _Ivil~12*|   .1024242   .1993298     0.46   0.642   .054393  -.288255  .493103
                          _Ivil~13*|  -.0580445   .2639815    -0.23   0.821   .058577  -.575439   .45935
                          _Ivil~14*|   .2225449   .1300554     1.22   0.222   .079498  -.032359  .477449
                          _Ivil~15*|   .2480099   .1192148     1.21   0.226   .033473   .014353  .481667
                          _Ivil~16*|  -.2983375   .2838056    -1.05   0.292   .041841  -.854586  .257911
                          _Ivil~18*|   .1462322   .1825131     0.67   0.500   .054393  -.211487  .503951
                          position |   .2005325   .0774143     2.60   0.009   3.60842   .048803  .352262
                          positi~q |  -.0229572   .0105735    -2.18   0.030   16.5397  -.043681 -.002233
                          ---------+--------------------------------------------------------------------
                            obs. P |   .6401674
                           pred. P |   .6938409  (at x-bar)
                          ------------------------------------------------------------------------------
                          (*) dF/dx is for discrete change of dummy variable from 0 to 1
                              z and P>|z| correspond to the test of the underlying coefficient being 0

                          When I run
                          Code:
                          esttab Model1 using table1.tab, replace beta se nocons pr2(2) obslast label title(Table 5—Time-Inconsistent Preferences and SHG Borrowing by Women) mtitle(Current Future Current Future Current Future) keep(pb_strong pb_weak dr_current dr_future pat_cur_impat_fut)order(pb_strong pb_weak dr_current dr_future pat_cur_impat_fut)
                          I get the following output:
                          Code:
                          ------------------------------------
                                                        (1)   
                                                    Current   
                          ------------------------------------
                          Strongly present-b~d        0.811** 
                                                    (0.327)   
                          
                          Weakly present-bia~d       -0.091   
                                                    (0.342)   
                          
                          Current discount r~e       -1.178***
                                                    (0.682)   
                          
                          Future discount rate                
                                                              
                          
                          Patient now, impat~u       -0.121   
                                                    (0.373)   
                          ------------------------------------
                          Pseudo R-squared             0.35   
                          Observations                  239   
                          ------------------------------------
                          Standardized beta coefficients; Standard errors in parentheses
                          * p<0.05, ** p<0.01, *** p<0.001
                          Nothing matches the output from the regression. What can I do? If I remove the "beta" from the esttab command the displayed values change but they are still wrong.

                          Thanks very much already in advance!

                          Comment


                          • #14
                            By default, esttab is giving you point estimates — the contents of e(b) — not what you want, but it is what the original poster wanted. With "beta", esttab is giving you beta coefficients — also not what you want. If you run "ereturn list" after your regression, you'll see all the matrices that the regression provides for further use, including e(dfdx) and e(se_dfdx). I presume these hold the values you seek. So:

                            Code:
                            esttab, main(dfdx) aux(se_dfdx)

                            Comment


                            • #15
                              Thanks! Someone also suggested to put margin and this worked too.

                              Comment

                              Working...
                              X