asdocx : Easy, yet extremely flexible program for publication quality tables in Stata Forums asdocx Forum How to do bys regression using ASDOCX in Stata 16 or stata 17

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • Aduba Joseph
    Participant
    Post count: 20

    Hello,
    It is possible to do a nested bys regression with asdocx in state 16 or state 17?
    For example, I have panel data of n-industry and t year. Now within the n-industry, I have four classifications: high tech, medium high tech, medium low tech and low tech. I want to estimate many panel data regressions for each industrial group using the nested function such that all regressions be nested in one table for each industrial group.
    e.g.

    bys group, sort : asdocx xtreg lnCt1 $xvar1, fe robust replace save(electricity) dec(4) stat(p, rmse) fs(8) font(Times New Roman) nest table_layout(autofit) 
    bys group, sort : asdocx xtreg lnCt1 $xvar2, fe robust save(electricity) dec(4) stat(p, rmse) fs(8) font(Times New Roman) nest 
    bys group, sort : asdocx xtreg lnCt1 $xvar3, fe robust save(electricity) dec(4) stat(p, rmse) fs(8) font(Times New Roman) nest
    bys group, sort : asdocx xtreg lnCt1 $xvar4, fe robust save(electricity) dec(4) stat(p, rmse) fs(8) font(Times New Roman) nest
    bys group, sort : asdocx xtreg lnCt1 $xvar5, fe robust save(electricity) dec(4) stat(p, rmse) fs(8) font(Times New Roman) nest
    bys group, sort : asdocx xtreg lnCt1 $xvar6, fe robust save(electricity) dec(4) stat(p, rmse) fs(8) font(Times New Roman) nest
    bys group, sort : asdocx xtreg lnCt1 $xvar7, fe robust save(electricity) dec(4) stat(p, rmse) fs(8) font(Times New Roman) nest
    bys group, sort : asdocx xtreg lnCt1 $xvar8, fe robust save(electricity) dec(4) stat(p, rmse) fs(8) font(Times New Roman) nest

    I expect each of the codes above to produce neatly nested Tables by industrial category (group). But this is not the case. I know there is a way to get this done but I simply don’t know how to figure it out. Any help?

    Dr. Attaullah Shah
    Keymaster
    Post count: 106

    I have added the bysort and by options for nested regressions. First update asdocx. One example is presented below:

    asdocx_update
    
    * Use grunfeld dataset
    webuse grunfeld
    
    * Just keep 5 companies in the dataset and then estimate regression for each company
    keep if company < 6
    
    * Note the bys company
    bys company : asdocx reg invest mvalue kstock, nest replace
                             
    
                                              Table: Regression results
      0 |1                                   2                3                4                5                6 
    ----+----------------------------------------------------------------------------------------------------------
      1 |                                  (1)              (2)              (3)              (4)              (5) 
    ----+----------------------------------------------------------------------------------------------------------
      2 |                                    1                2                3                4                5 
      3 |mvalue                       0.118***         0.118***         0.118***         0.118***         0.118*** 
      4 |                              (0.009)          (0.009)          (0.009)          (0.009)          (0.009) 
      5 |kstock                       0.256***         0.256***         0.256***         0.256***         0.256*** 
      6 |                              (0.039)          (0.039)          (0.039)          (0.039)          (0.039) 
      7 |_cons                      -63.611***       -63.611***       -63.611***       -63.611***       -63.611*** 
      8 |                             (22.376)         (22.376)         (22.376)         (22.376)         (22.376) 
      9 |Observations                      100              100              100              100              100 
     10 |R-squared                       0.761            0.761            0.761            0.761            0.761 
    ---------------------------------------------------------------------------------------------------------------
    
    
    Bijaya Kumar Padhi
    Participant
    Post count: 4

    Do the same code will work for logistic regressions for nested tables?

    Dr. Attaullah Shah
    Keymaster
    Post count: 106

    Hello Prof. Bijaya Kumar
    Yes, nested regression tables can be created for all regression commands. See this example

    webuse lbw
    asdocx logistic low age lwt i.race smoke ptl ht ui, replace nest
    asdocx logistic low age lwt i.race  ptl ht ui,  nest
    asdocx logistic low age lwt i.race smoke ,  nest
    
                               Table: Regression results
      0 |1                                  2               3               4 
    ----+-----------------------------------------------------------------------------
      1 |                                 (1)             (2)             (3) 
      2 |                                 low             low             low 
    ----+-----------------------------------------------------------------------------
      3 |age                           -0.027          -0.032          -0.023 
      4 |                             (0.036)         (0.035)         (0.034) 
      5 |lwt                         -0.015**        -0.017**         -0.013* 
      6 |                             (0.007)         (0.007)         (0.006) 
      7 |1bn.race                                                             
      8 |                                                                     
      9 |2.race                       1.263**         1.042**         1.231** 
     10 |                             (0.526)         (0.508)         (0.517) 
     11 |3.race                       0.862**            0.41         0.944** 
     12 |                             (0.439)          (0.38)         (0.416) 
     13 |smoke                        0.923**                        1.054*** 
     14 |                             (0.401)                          (0.38) 
     15 |ptl                            0.542         0.679**                 
     16 |                             (0.346)         (0.341)                 
     17 |ht                          1.833***        1.896***                 
     18 |                             (0.692)         (0.709)                 
     19 |ui                            0.759*          0.767*                 
     20 |                             (0.459)         (0.446)                 
     21 |_cons                          0.461           1.308            0.33 
     22 |                             (1.205)          (1.15)         (1.108) 
     23 |Observations                     189             189             189 
     24 |Pseudo R2                      0.142           0.118           0.086 
    ----------------------------------------------------------------------------------
    
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.