Announcement

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

  • xtreg, reg + dummies, areg, reghdfe - Differences in clustering standard error results

    Hello everyone,
    As the title suggests, I've noticed that the four commands above report different panelvar clustering standard errors: xtreg and reghdfe are the same, reg + dummies and areg are the same.
    I'm not sure why and I'm wondering which result should be used in my publication?
    Any suggestions/discussions are greatly appreciated.
    Thank you in advance.

    Code:
    . webuse abdata, clear
    
    . 
    . qui xtreg n k w ys i.year, fe vce(cluster id)
    
    . estimate store fe
    
    . qui reg n k w ys i.year i.id, vce(cluster id)
    
    . estimate store lsdv
    
    . qui areg n k w ys, a(year id) vce(cluster id)
    
    . estimate store areg
    
    . qui reghdfe n k w ys, a(year id) vce(cluster id)
    
    . estimate store reghdfe
    
    . 
    . esttab fe lsdv areg reghdfe, b(9) se(9) drop (*.year *.id _cons) mtit("FE" "LSDV" "areg
    > " "reghdfe")
    
    ----------------------------------------------------------------------------
                          (1)             (2)             (3)             (4)   
                           FE            LSDV            areg         reghdfe   
    ----------------------------------------------------------------------------
    k             0.547559752***  0.547559752***  0.547559752***  0.547559752***
                 (0.050708988)    (0.054567078)    (0.054567078)    (0.050708988)   
    
    w            -0.296876750*   -0.296876750*   -0.296876750*   -0.296876750*  
                 (0.126299732)    (0.135908990)    (0.135908990)    (0.126299732)   
    
    ys            0.264825436     0.264825436     0.264825436     0.264825436   
                 (0.152961447)    (0.164599208)    (0.164599208)    (0.152961447)   
    ----------------------------------------------------------------------------
    N                    1031            1031            1031            1031   
    ----------------------------------------------------------------------------
    Standard errors in parentheses
    * p<0.05, ** p<0.01, *** p<0.001
    Manh Hoang-Ba,
    Facebook,
    Eureka! Uni - YouTube,
    ManhHB94 (Manh Hoang Ba),
    Hoàng Bá Mạnh – Kinh tế lượng: Lý thuyết và ứng dụng

  • #2
    Manh:
    from -areg- entry, Stata .pdf manual:
    areg with vce(robust) or vce(cluster clustvarlist) with only one variable specified in clustvarlist
    works similarly, calling robust after regress to produce the Huber/White/sandwich estimator
    of the variance or its clustered version.
    That said, I would go:

    Code:
    xtreg n k w ys i.year, fe vce(cluster id
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Originally posted by Manh Hoang Ba View Post
      I've noticed that the four commands above report different panelvar clustering standard errors: xtreg and reghdfe are the same, reg + dummies and areg are the same.
      I'm not sure why and I'm wondering which result should be used in my publication?
      If you have panel data, you should use xtreg or reghdfe, as these are panel-data estimators. The difference lies in how degrees-of-freedom adjustments are handled, which is discussed in the reghdfe documentation.

      clusters will check if a fixed effect is nested within a clustervar. In that case, it will set e(K#)==e(M#) and no degrees-of-freedom will be lost due to this fixed effect. The rationale is that we are already assuming that the number of effective observations is the number of cluster levels. This is the same adjustment that xtreg, fe does, but areg does not use it.
      Therefore, you will obtain the same standard errors only if the cluster variable differs from the panel (absorbed) variable and there is no nesting. Otherwise, regress and areg unfairly penalize the degrees of freedom associated with the fixed effects, which should not happen when the panel variable and the cluster variable coincide. Consider:

      Code:
      webuse abdata, clear
      
      qui areg n k w ys, a(year) vce(cluster id)
      estimate store areg
      
      qui reghdfe n k w ys, a(year) vce(cluster id)
      estimate store reghdfe
      
      esttab areg reghdfe, b(9) se(9) drop (_cons) mtit("areg" "reghdfe")
      Res.:

      Code:
      . esttab areg reghdfe, b(9) se(9) drop (_cons) mtit("areg" "reghdfe")
      
      --------------------------------------------
                            (1)             (2)  
                           areg         reghdfe  
      --------------------------------------------
      k             0.807387035***  0.807387035***
                   (0.033313425)    (0.033313425)  
      
      w            -0.383153163    -0.383153163  
                   (0.218632680)    (0.218632680)  
      
      ys            0.503653475     0.503653475  
                   (0.392376439)    (0.392376439)  
      --------------------------------------------
      N                    1031            1031  
      --------------------------------------------
      Standard errors in parentheses
      * p<0.05, ** p<0.01, *** p<0.001
      Last edited by Andrew Musau; 12 Jan 2026, 01:52.

      Comment


      • #4
        Thanks to Carlo Lazzaro and Andrew Musau
        My intuition tells me to use xtreg, but I still want to understand the reason for the difference, which Andrew Musau has clearly explained above. Thank you again.
        Manh Hoang-Ba,
        Facebook,
        Eureka! Uni - YouTube,
        ManhHB94 (Manh Hoang Ba),
        Hoàng Bá Mạnh – Kinh tế lượng: Lý thuyết và ứng dụng

        Comment

        Working...
        X