Announcement

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

  • Bug in xtreg, fe robust: wrong standard errors?

    I am running a linear regression on a panel dataset, using fixed effects and robust standard errors in Stata 14.1. using the command "xtreg, fe robust".
    I am wondering whether there is a bug in the calculation of standard errors, leading to too narrow standard errors and flawed inference on the statistical significance of regressors.

    "xtreg, fe robust" gives smaller standard errors than running "reg, robust" after demeaning of the data and adjusting standard errors manually for the degrees of freedom.

    ------------------------------------------------------------------------------------------------------------
    clear
    sysuse auto
    replace length=length/10
    tab head
    local df = r(r) - 1
    sort head
    by head: egen mean = mean(mpg)
    by head: gen newmpg = mpg-mean
    drop mean
    by head: egen mean = mean(len)
    by head: gen newlen = len-mean
    drop mean

    regress newmpg newlen, robust
    mat b=e(b)
    scalar vadj = e(df_r)/(e(N)-1-(e(df_m) + `df'))
    matrix V = vadj*e(V)

    cap program drop change
    program change, eclass
    eret post b V
    end
    change
    eret display
    xtreg mpg len, i(head) fe robust
    ------------------------------------------------------------------------------------------------------------

    When running the same code without the ", robust" option, the manual df-adjustment of the standard errors gives the same result als "xtreg, fe".

    If my suspicion is correct, in all estimations based on the command "xtreg, fe robust" the precision on the resulting coefficients is overestimated, which leads to a too confident interpretation of the regressors as being statistically significant.

    I would be grateful for comments that can solve this issue!
    Many thanks,
    Doris
    Last edited by Doris Oberdabernig; 25 Feb 2016, 10:25.

  • #2
    It is not a bug; it is by design. When -robust- is specified with -xtreg, fe-, it is reinterpreted as the cluster robust standard error, clusters being the panel variables specified in xtset., which is different from what you have calculated using regression of de-meaned variables with the sandwich estimator.

    Comment


    • #3
      Doris:
      what your code line

      Code:
      regress newmpg newlen, robust
      becomes:

      Code:
      regress newmpg newlen, vce(cluster headroom)
      .

      The difference is probably due to the fact that, under -xtreg-, -robust- and -cluster- are equivalent (whereas it does not hold under -regress-).

      PS: Cyber-crossed with Clyde's reply, I notice!
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment


      • #4
        Dear Clyde and Carlo,
        Thank you for your quick responses.

        Is there an option to specify the same Huber/White/sandwich estimator with -xtreg, fe- equivalent to the one obtained with -reg, robust- ?

        Many thanks,
        Doris

        Comment


        • #5
          Not as far as I can tell. I think your approach of doing OLS on de-meaned data with the sandwich VCE estimator is what I would do if this were my goal.

          Going a bit beyond my depth, let me wonder why you want to do this. Generally speaking when Stata designs things in ways that make it cumbersome or impossible to do something, it is usually because doing that something is a bad idea. I can't claim a good enough understanding of these estimators to tell you why it wouldn't make sense to use a non-clustered robust estimator in this context, but just the fact that it isn't available as an option makes me suspect that it doesn't. Perhaps somebody with more expertise in this area can chime in: I'd like to learn.
          Last edited by Clyde Schechter; 25 Feb 2016, 11:13.

          Comment


          • #6
            Dear Doris,

            Clyde correctly guessed that the reason why Stata does not allow you to do what you want is because that would generally be invalid; see

            Stock, J. H., and M. W. Watson. 2008. Heteroskedasticity-robust standard errors for fixed effects panel data regression. Econometrica 76: 155–174.

            Having said that, I find it very unfortunate that the option -vce(robust)- does different things for different commands; used with -xtreg- it will also do different things with different versions of Stata. This is an endless source of confusion for less experienced users and a frequent source of coding errors.

            All the best,

            Joao

            Comment


            • #7
              Thanks, Clyde.

              To answer your question: why shouldn't I want to do this?
              Indeed in my setup I want to double-demean my data to account for individual and time fixed effects (that is why I tried to demean my data manually rather than using the -fe- option with -xtrg-). I want to account for arbitrary forms of hetroscedasticity. As I have individual and time fixed effects rather than cluster fixed effects, I prefer not to restrict the form of hetroscedasticity to a cluster variable.

              Your comment made me check again whether there is any reason to use clustered standard errors when running fixed-effects regressions, rather than accounting for more general forms of heteroscedasticity. Indeed, Cameron & Trivedi (Microeconometrics - Methods and Applications) referring to Arellano (1987, Computing Robust Standard Errors for Within-Group Estimators, Oxford Bulletin of Economics and Statistics) suggest such a sandwich type VCE estimator as a panel-robust estimate of the asymptotic variance matrix for models using the within transformation.

              I am surprised to learn that this option is not implemented in the -xtreg- command, as, taking the example of above, it would not be a very complicated thing to do. Probalby I am missing out on somthing here. I would be happy to learn more about this as well.

              Edit: I just realized that Joao wrote back while I was checking references. Thanks, Joao, I will consult the reference you sent, and thanks as well for your info on the -vce(robust)- option with differnt estimators. I also find this quite unfortunate.
              Last edited by Doris Oberdabernig; 25 Feb 2016, 13:48.

              Comment


              • #8
                Doris,

                I think you missed my post above. Anyway, note that clustering by a variable does not restrict the pattern of heteroskedasticity, it only restricts the patterns of correlation that are accounted for.

                Best wishes,

                Joao

                Comment


                • #9
                  Thanks, Joao!

                  Comment


                  • #10
                    Dear Joao, I just realized that I missed your post while I was editing my message. Thanks a lot for your help and the reference.

                    Comment

                    Working...
                    X