Announcement

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

  • cgmreg - storing the number of observations

    I have a problem in pubIishing the estimation tables using esttab as I am unable to store the statistics of the cgmreg.
    When I attempt to store the estimates results using
    estso, it works but it only stores the coefficients but not the number of observation which results in publishing tables that have empty observations.

    I highly appreciate your help.

    My code is as follows:
    xi: cgmreg neonatal commonlaw rural poor birthinterval i.v106 bord age_mother un_population_density_2015 mother_works malaria_prevalence_2015 land_surface_temperature_2015 aridity_2015 rainfall_2015 dhsyear distkm_sq if distkm<=200, cluster (cohort ethnicity)
    eststo neo1
    esttab neo1 neo2 neo3 using Neonatal.tex,label nonumbers ///
    longtable nogaps p staraux starlevels( * 0.10 ** 0.05 *** 0.01) mtitles( "less than 200 Km" "less than 150 km" "less than 100 Km") compress title(\label{Table 3}Dependent Variable: Neonatal Mortality)
    stats(N,fmt(%9.0fc)) addnotes("Standard errors are clustered at the ethnic and country level using the approach of Cameron, Gelbach, and Miller (2011)) replace // ///



  • #2
    I am not a user of esttab, but reading the output of help esttab suggests that
    Code:
    stats(N,fmt(%9.0fc))
    might also be coded as
    Code:
    scalars(N) sfmt(%9.0fc)
    or something like that.

    Comment


    • #3
      I am afraid that "etsto" does not store the number of observations to begin with and that's why they do not show up.

      Comment


      • #4
        Do you have anything that confirms that eststo does not store the number of observations? Here is an example using regress rather than cgmreg (a user written command) that demonstrates that the stored estimates in that case do include the number of observations. Perhaps you could try the same thing - using estimates replay and using a very simple esttab command with output to the Results window - with your models to narrow down the source of the problem.
        Code:
        . sysuse auto, clear
        (1978 Automobile Data)
        
        . regress price weight
        
              Source |       SS           df       MS      Number of obs   =        74
        -------------+----------------------------------   F(1, 72)        =     29.42
               Model |   184233937         1   184233937   Prob > F        =    0.0000
            Residual |   450831459        72  6261548.04   R-squared       =    0.2901
        -------------+----------------------------------   Adj R-squared   =    0.2802
               Total |   635065396        73  8699525.97   Root MSE        =    2502.3
        
        ------------------------------------------------------------------------------
               price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
              weight |   2.044063   .3768341     5.42   0.000     1.292857    2.795268
               _cons |  -6.707353    1174.43    -0.01   0.995     -2347.89    2334.475
        ------------------------------------------------------------------------------
        
        . eststo model1
        
        . quietly regress turn weight foreign
        
        . eststo model2
        
        . estimates replay model1
        
        ------------------------------------------------------------------------------------------------
        Model model1
        ------------------------------------------------------------------------------------------------
        
              Source |       SS           df       MS      Number of obs   =        74
        -------------+----------------------------------   F(1, 72)        =     29.42
               Model |   184233937         1   184233937   Prob > F        =    0.0000
            Residual |   450831459        72  6261548.04   R-squared       =    0.2901
        -------------+----------------------------------   Adj R-squared   =    0.2802
               Total |   635065396        73  8699525.97   Root MSE        =    2502.3
        
        ------------------------------------------------------------------------------
               price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
              weight |   2.044063   .3768341     5.42   0.000     1.292857    2.795268
               _cons |  -6.707353    1174.43    -0.01   0.995     -2347.89    2334.475
        ------------------------------------------------------------------------------
        
        . esttab model1 model2
        
        --------------------------------------------
                              (1)             (2)  
                            price            turn  
        --------------------------------------------
        weight              2.044***      0.00422***
                           (5.42)         (10.29)  
        
        foreign                            -1.810*  
                                          (-2.61)  
        
        _cons              -6.707           27.45***
                          (-0.01)         (19.70)  
        --------------------------------------------
        N                      74              74  
        --------------------------------------------
        t statistics in parentheses
        * p<0.05, ** p<0.01, *** p<0.001
        
        .
        Last edited by William Lisowski; 07 Mar 2019, 08:37.

        Comment


        • #5
          Thank you so much for your prompt reply. I will try again using regress rather than cgmreg

          Comment


          • #6
            No, I am not suggesting you use regress - I just did that because I don't have cgmreg. You should do something like
            Code:
            xi: cgmreg ...
            eststo neo1
            estimates replay neo1
            esttab neo1

            Comment

            Working...
            X