Announcement

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

  • Use estadd

    Hey there,

    I need your help with the replication of a Regression and the command estadd.
    The problem ist, I don't know how to use it.

    For my regression I already got:

    eststo multinationals: cluster2 Cta UTB fycetr fytax fcons nol lofi nwcap lev EBITDA mtbr size dipa capex acqi atcf rd industry* if mne==1, fcluster(gvkey) tcluster(fyear)
    eststo domestics: cluster2 Cta UTB fycetr fytax fcons nol lofi nwcap lev EBITDA mtbr size dipa capex acqi atcf rd industry* if mne==0, fcluster(gvkey) tcluster(fyear)

    esttab model1 multinationals domestics using table4_complete.html, replace label ///
    mtitle("Full Sample" "Multinationals" "Domestics") nonumbers ///
    mgroup ("Dependent Variable = Cash-to-Assets") nonumbers ///
    title("Table 4: The effect of tax uncertainty on cash holdings") ar2 indicate(fixed effects= industry*) b(3) compress nonotes

    the fixed effects arn't complete yet.

    and know I would like to add some more information, like the sum of the firms (already gen), the sum of observations, the clustering, fixed effects and r2.
    The scheme should look like that in the end:
    Click image for larger version

Name:	Bildschirmfoto 2021-02-22 um 11.03.19.png
Views:	1
Size:	47.9 KB
ID:	1594428



    I hope you can help me!

  • #2
    estout is from the Stata Journal (FAQ Advice #12). I do not use the community-contributed command cluster2, but here is a way using xtreg. The main take is to add the information using estadd after each estimation.

    Code:
    webuse grunfeld, clear
    eststo m1: xtreg invest mvalue kstock if company <8, fe
    estadd local Firms `=e(N_g)'
    estadd local Clustering None
    estadd local FE Firm  
    eststo m2: xtreg invest mvalue kstock i.year, fe cluster(company)
    estadd local Firms `=e(N_g)'
    estadd local Clustering Firm
    estadd local FE Firm and Year
    esttab m1 m2, drop(*.year _cons) stats(N r2_w Firms Clustering FE, ///
    labels(Observations R-squared Firms Clustering "Fixed Effects"))
    Res.:

    Code:
    . esttab m1 m2, drop(*.year _cons) stats(N r2_w Firms Clustering FE, ///
    > labels(Observations R-squared Firms Clustering "Fixed Effects"))
    
    --------------------------------------------
                          (1)             (2)   
                       invest          invest   
    --------------------------------------------
    mvalue              0.114***        0.118***
                       (8.09)         (10.88)   
    
    kstock              0.314***        0.358***
                      (15.35)          (7.48)   
    --------------------------------------------
    Observations          140             200   
    R-squared           0.777           0.799   
    Firms                   7              10   
    Clustering           None            Firm   
    Fixed Effe~s       Firm      Firm and Year   
    --------------------------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001
    Last edited by Andrew Musau; 22 Feb 2021, 04:57.

    Comment


    • #3
      Click image for larger version

Name:	Bildschirmfoto 2021-02-22 um 15.27.41.png
Views:	1
Size:	58.5 KB
ID:	1594485
      Thank you very much!
      Your answer is a big help for us!

      But there is one more question:

      with which estadd command Is is possible to generate the groups of firms, because your command doesn't work with my data (`=e(N_g)')
      I tried a lot but with local or scalar there is no value. Can I generate the variable before and just put it in with the estadd command?

      Thank you a lot!
      Last edited by Mar Lina; 22 Feb 2021, 07:28.

      Comment


      • #4
        Code:
        webuse grunfeld, clear
        eststo m1: xtreg invest mvalue kstock if company <8, fe
        egen nfirms= tag(company) if e(sample)
        count if nfirms
        estadd local Firms `r(N)'
        drop nfirms
        eststo m2: xtreg invest mvalue kstock i.year, fe cluster(company)
        egen nfirms= tag(company) if e(sample)
        count if nfirms
        estadd local Firms `r(N)'
        drop nfirms
        esttab m1 m2, drop(*.year _cons) stats(Firms)
        Res.:

        Code:
        . esttab m1 m2, drop(*.year _cons) stats(Firms)
        
        --------------------------------------------
                              (1)             (2)   
                           invest          invest   
        --------------------------------------------
        mvalue              0.114***        0.118***
                           (8.09)         (10.88)   
        
        kstock              0.314***        0.358***
                          (15.35)          (7.48)   
        --------------------------------------------
        Firms                   7              10   
        --------------------------------------------
        t statistics in parentheses
        * p<0.05, ** p<0.01, *** p<0.001

        Comment


        • #5
          Also #3, use the -format()- suboption within -stats()- so that the number of observations, which is an integer, is not displayed with decimals.

          Code:
          stats(r2_w N, fmt(%9.3f %9.0g) labels("Within R-squared" Observations)

          Comment


          • #6
            Thanks a lot!

            I tried the thing for the firms, but I have to change it a bit. And now it doesn't work:

            eststo model1: cluster2 Cta UTB fycetr fytax fcons nol lofi nwcap lev EBITDA mtbr size dipa capex acqi atcf rd, fcluster(gvkey) tcluster(fyear)
            egen nfirms= tag(gvkey) if e(sample)
            count if nfirms
            estadd local nfirms `r(N)'
            drop nfirms
            estadd local FE Firm and Year
            estadd local Clustering By Industry and Year

            esttab model1 using table49.html, replace label ///
            drop (_cons) stats(nfirms N FE Clustering r2,fmt(%9.3f %9.0g) labels(Firms N "Fixed-Effects" Clustering "R-squared"))

            (the same for all of them)

            I tried to find the mistake, but nothing what I have done worked.
            I used gvkey, because this variable stands for the ID of the firms and company is not a variable of my data.

            Also I tried it with:
            sum gvkey
            egen firm = group(gvkey)
            egen mmfirm = group(gvkey) if mne==1
            egen dmfirm = group(gvkey) if mne==0
            but I don't know how to put the max into estadd...

            Maybe you can help me again or have another hint?
            Thank you a lot!!!

            Comment


            • #7
              As I said in #2, I don't use cluster2 so I cannot help with an issue arising from that command. Most estimation commands will mark the estimation sample and thus the code in #4 should work, as it does with xtreg. The only additional advice that I can offer is to try out reghdfe from SSC that allows multi-way clustering and marks the estimation sample. You can either retrieve the number of groups from ereturn list after running the command or use the code in #4.

              Comment

              Working...
              X