Announcement

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

  • Esttab and vce

    Esttab/Estout is a user add-on, can be found here: http://repec.sowi.unibe.ch/stata/estout/

    Is there anyway to change the labeling of vces per what I want? for example, this code:
    Code:
    clear all
    sysuse auto
    eststo: reg price mpg
    eststo: reg price mpg, vce(cluster rep78)
    esttab, label stats(vce)
    will output this:
    Code:
    ----------------------------------------------------
                                  (1)             (2)   
                                Price           Price   
    ----------------------------------------------------
    Mileage (mpg)              -238.9***       -226.4   
                              (-4.50)         (-2.74)   
    
    Constant                  11253.1***      10965.2** 
                               (9.61)          (6.89)   
    ----------------------------------------------------
    vce                           ols         cluster   
    ----------------------------------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001
    I wish to output something like this:
    Code:
    ----------------------------------------------------
                                  (1)             (2)   
                                Price           Price   
    ----------------------------------------------------
    Mileage (mpg)              -238.9***       -226.4   
                              (-4.50)         (-2.74)   
    
    Constant                  11253.1***      10965.2** 
                               (9.61)          (6.89)   
    ----------------------------------------------------
    Standard Errors          Regular     Repair Record Clusters   
    ----------------------------------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001
    Can this be done?

  • #2
    I found a solution with estout's "substitute()" command. just use:
    Code:
     esttab ,label stats(vce) substitute(ols Regular cluster "Repair Record Clusters")

    Comment


    • #3
      I believe I have a similar question. I want to display different models in one table that use the "vce" option, but that cluster standard errors by different variables in the table.
      For example, the dataset used below contains weight data on 48 pigs over time, which I, for the sake of this example, divide into 6 pig families.

      Now, I want to compare the same regression, once with standard errors clustered at the -pig- level (each with a different -id-), once with them clustered only at the -pigfamily- level (each family has a separate -pigfamily- value).

      This means that the estout-output should indicate in the "vce" row not only "cluster", but what cluster. How can this be done?
      Below is the stata code, and the output.
      Code:
      webuse pig.dta, clear
      
      gen pigfamily = round(id/10)+1
      estimates clear
      eststo: reg weight week, vce (cluster id)
      eststo: reg weight week, vce (cluster pigfamily)
      
      esttab * using "thatlldo.tex", replace stats(N r2_a vce, labels("observations" "adjusted \(R^{2}\)" "VCE estimation")) ///
          substitute (cluster "pig-level SE" "pig-family-level SE")
      Code:
      {
      
      \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
      
      \begin{tabular}{l*{2}{c}}
      
      \hline\hline
      
      &\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}\\
      
      &\multicolumn{1}{c}{weight}&\multicolumn{1}{c}{weight}\\
      
      \hline
      
      week & 6.210\sym{***}& 6.210\sym{***}\\
      
      & (67.39) & (65.19) \\
      
      [1em]
      
      _cons & 19.36\sym{***}& 19.36\sym{***}\\
      
      & (47.87) & (25.86) \\
      
      \hline
      
      observations& 432 & 432 \\
      
      adjusted \(R^{2}\)& 0.930 & 0.930 \\
      
      VCE estimation& pig-level SE & pig-level SE \\ [this should say "pig-family-level SE" or similar!]
      
      \hline\hline
      
      \multicolumn{3}{l}{\footnotesize \textit{t} statistics in parentheses}\\
      
      \multicolumn{3}{l}{\footnotesize \sym{*} \(p<0.05\), \sym{**} \(p<0.01\), \sym{***} \(p<0.001\)}\\
      
      \end{tabular}
      
      }
      Last edited by Max Piper; 26 Jun 2018, 04:27.

      Comment


      • #4
        You can use clustvar for this:

        Code:
        sysuse auto
        eststo: reg price mpg
        eststo: reg price mpg, vce(cluster rep78)
        esttab, stats(vce clustvar)

        Comment


        • #5
          Thank you. That works.
          But do you also know how the variable label, instead of the variable name of clustvar, can be displayed? using the label option of estout only displays labels of dependent and independent variables:
          Code:
          sysuse auto,clear
          estimates clear
          eststo: reg price mpg
          eststo: reg price mpg, vce(cluster rep78)
          esttab, label stats(vce clustvar)
          Best,
          Max

          Comment


          • #6
            Just use substitute:

            esttab, label stats(vce clustvar) substitute(rep78 "Repair Record")

            Comment

            Working...
            X