Announcement

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

  • robust / clustered standard errors in a fixed effects panel (xtreg)

    I have a very straightforward question:

    Why do these three commands:
    Code:
    xtreg [formula], fe r
    xtreg [formula], fe r cluster(id)
    xtreg [formula], fe vce(cluster id)
    produce identical standard errors? The fixed effects take care of the intercept but there could still be heteroskedasticity acting over time, no? Still, publications always say that they use 'robust standard errors clustered at the individual level' in fixed effects panels... I don't understand why both is necessary if the robust option already produces the same results as clustering.


    Here an example (please let me know if there is a better way to get an example dataset into Stata, the sysuse data usually does not have two panel dimensions...). This is of course a random dataset but I have the same issue in a very large real world dataset that probably has some heteroskedasticity somewhere (at least 4 dots after the comma some results should change if Stata doesn't do the exact same thing in these three cases...):
    Code:
    set seed 123
    set obs 900
    gen y= runiform()
    gen x= rbinomial(1,0.05)
    gen countvar= _n
    gen id = 1 if countvar <= 300
    replace id = 2 if countvar >300
    replace id = 3 if countvar >600
    bysort id : gen time = _n
    replace y = y + countvar if id==1
    
    
    xtset id time
    xtreg y x i.time, fe r
    xtreg y x i.time, fe r cluster(id)
    xtreg y x i.time, fe vce(cluster id)

  • #2
    Frank:
    under -xtreg- the options -robust- and -cluster()- do produce tha same standard errors.
    However, this result does not hold for one-wave data linear model, such as -regress-.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Thank you Carlo. Does -robust- cluster in the background or am I missing some theory on robust standard errors? Are they already robust to group autocorrelation if the group is the panel id dimension?

      Comment


      • #4
        Frank:
        under -xtreg- -robust- and -cluster()- options accomodates for bot autocorrelation and/or heteroskedasticity (see -xtreg- entry for more details).
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment


        • #5
          Thanks a lot Carlo!

          If any one googles this, here is the section:

          "The robust standard errors reported above are identical to those obtained by clustering on the panel variable idcode. Clustering on the panel variable produces an estimator of the VCE that is robust to cross-sectional heteroskedasticity and within-panel (serial) correlation that is asymptotically equivalent to that proposed by Arellano (1987). Although the example above applies the fixed-effects estimator, the robust and cluster–robust VCE estimators are also available for the random-effects estimator. Wooldridge (2013) and Arellano (2003) discuss these robust and cluster–robust VCE estimators for the fixed-effects and random-effects estimators. More details are available in Methods and formulas"

          on page 15 here:
          https://www.stata.com/manuals13/xtxtreg.pdf

          and even more explicit on page 25:

          "As discussed by Wooldridge (2013), Stock and Watson (2008), and Arellano (2003), specifying vce(robust) is equivalent to specifying vce(cluster panelvar), where panelvar is the variable that identifies the panels."
          Last edited by Frank Taumann; 01 Mar 2018, 06:26.

          Comment


          • #6
            Carlo Lazzaro

            under -xtreg- -robust- and -cluster()- options accomodates for bot autocorrelation and/or heteroskedasticity
            Is this also true for the -xtivreg- and -xtivreg2- commands?

            Comment


            • #7
              It's true of xtivreg but not for the community contributed command xtivreg2. You have to be careful using the "robust" option with xtivreg2 because unless T is "large," there are no reliable standard errors robust only to heteroskedasticity. It's very difficult these days with moderate N and T not too large to use cluster(id) or vce(cluster id).

              Comment

              Working...
              X