Announcement

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

  • esttab drop option

    I have many similar regressions (in a loop) with many nuisance variables. As the sample changes, sometimes dummies are dropped from the regression by the xtreg command itself.. If I have listed the variable in the -esttab- -drop- optiion, that is a fatal error. I would prefer not to have hundreds of meaningless insignificant coefficients cluttering the output. Is there a way around this, or is there a replacement for -esttab- that avoids this problem? I am using version 2.0.5 from SSC.

    Daniel Feenberg
    NBER
    http://www.nber.org/stata/efficient

  • #2
    Assume you have a setup similar to this (in a loop):
    Code:
    eststo clear
            
    sysuse auto, clear
    
    // fixed list of vars to drop
    local todrop mpg
    
    // regression 1       
    quietly regress price weight mpg rep78 foreign
    esttab, ar2 drop(`todrop')
    
    // regression 2        
    quietly regress price weight foreign
    esttab, ar2 drop(`todrop')
    which terminates in this error:

    coefficient mpg not found
    r(111);

    Then consider something like:
    Code:
    eststo clear
            
    sysuse auto, clear
    
    // fixed list of vars to drop
    local todrop mpg
    
    // regression 1       
    quietly regress price weight mpg rep78 foreign
    
    local all = e(cmdline)
    local cmddepvar = "`e(cmd)' `e(depvar)'"
    local indepvar: list all - cmddepvar
    local tokeep: list indepvar - todrop
    
    esttab, ar2 keep(`tokeep')
    
    // regression 2        
    quietly regress price weight foreign
    
    local all = e(cmdline)
    local cmddepvar = "`e(cmd)' `e(depvar)'"
    local indepvar: list all - cmddepvar
    local tokeep: list indepvar - todrop
    
    esttab, ar2 keep(`tokeep')
    See -help macrolists-. Also http://www.stata.com/statalist/archi.../msg00369.html for other options on recuperating the list of regressors.
    You should:

    1. Read the FAQ carefully.

    2. "Say exactly what you typed and exactly what Stata typed (or did) in response. N.B. exactly!"

    3. Describe your dataset. Use list to list data when you are doing so. Use input to type in your own dataset fragment that others can experiment with.

    4. Use the advanced editing options to appropriately format quotes, data, code and Stata output. The advanced options can be toggled on/off using the A button in the top right corner of the text editor.

    Comment


    • #3
      Thanks for the suggestion. I guess I was hoping I had missed something simple.

      I have one more problem with -esttab-, though. If I have

      eststo m1 : regress y x
      esttab eqlabels("m1")

      shouldn't the output column be headed with "m1" rather than "(1)"? I have found several examples for the eqlabel option on the Stata website and elsewhere, but haven't found any documentation for it. Is there documentation that would tell me what I was doing wrong?

      Daniel Feenberg
      NBER

      Comment

      Working...
      X