Announcement

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

  • Heteroskedasticity test (-ivhettest-) with fixed effects

    Dear All,

    In 2010, MarkSchaffer explained that the ivhettest does not produce valid results after a panel fixed effects estimation:

    ... I should note that the test employed by -ivhettest- (as well as Stata's -estat hettest- and others, I suspect) isn't valid after panel data estimation with fixed effects. The reason is that the test based on the contrast between the classical non-robust VCV and the heteroskedastic-robust VCV, as per White (Econometrica 1980). However, as Stock and Watson (Econometrica 2008) have shown, the standard Eicker-Huber-White-robust-sandwich VCV isn't consistent for the standard fixed effects estimator. Thus the test isn't valid, because in the presence of heteroskedasticity it's contrasting two different inconsistent VCVs.
    (https://www.stata.com/statalist/arch.../msg00266.html)

    Is there any update on this?

    Which command to check for heteroskedasticity in the error term can be employed after running xtivreg2, fe?

  • #2
    why not just cluster/robust and call it a day? do you have to do a test?

    HTML Code:
    https://www.stata.com/support/faqs/statistics/panel-level-heteroskedasticity-and-autocorrelation/

    Comment


    • #3
      In my case I want to test whether the assumptions for applying the Lewbel's approach for heteroskedasticity-based constructed instruments hold. To check the validity of this approach, you need to do some heteroskedasticity tests with -ivhettest-.

      My model is:
      Code:
      ivreg2h y2 X (y1 = ), fe cluster(hhid) first endog(y1)
      To test heteroskedasticity, I would then (in a non-fixed effects setting), run:
      Code:
      ivhettest, all
      Unfortunately, this test is not valid for FE. What can I do instead to conduct the Pagan-Hall general test statistic and Breusch-Pagan/Godfrey/Cook-Weisberg test?

      Comment


      • #4
        HTML Code:
        https://www.stata.com/statalist/archive/2009-12/msg00019.html

        Comment


        • #5
          So just take the N*R-sq stat, multiply by (N-M)/N
          https://www.stata.com/statalist/arch.../msg00019.html

          Does it also refer to the p-value of the White/Koenker nR test statistic? How do compute the respective p-value?

          Comment


          • #6
            You'd have to use a statistical distribution to recompute the probability level of the adjusted statistic. The stat may be so large that the adjustment doesn't matter much.

            Comment


            • #7
              "You'd have to use a statistical distribution to recompute the probability level of the adjusted statistic." --> How do I do that?
              "The stat may be so large that the adjustment doesn't matter much." --> What do you mean?

              Comment


              • #8
                I think it's it a chi2. So it would be chi2(df,x), where df is the degrees of freedom and x is the value you compute.
                If M is small relative to N, then (N-M)/N is very small, so the statistic won't change much. If it's significant at the 0.000001 level, the adjustment isn't going to change that if small M small relative to N.

                Comment


                • #9
                  This is intuitive - thank you!

                  Regarding the Breusch-Pagan/Godfrey/Cook-Weisberg test. Could I simply rely on the finding by Hahn, J., & Shi, R. (2021). Breusch and Pagan’s (1980) Test Revisited (No. 202110). https://economics.ucr.edu/repec/ucr/wpaper/202110.pdf that "the noise need not be accounted for one-way linear models or general two-way models" and use the Breusch-Pagan/Godfrey/Cook-Weisberg test statistic from - ivhettest, ivsq all - ?

                  Comment


                  • #10
                    Code:
                    clear
                    cd S:\STATA
                    use https://www.stata-press.com/data/r17/abdata.dta
                    
                    xtset id year
                    g lwage = ln(wage)
                    
                    ** CENTER VARIABLES
                    foreach var in wage lwage emp cap indoutpt n w {
                         bys id: center `var' , g(c_`var')
                        }
                        
                    ** XTIVREG2
                    eststo e1: xtivreg2 lwage emp cap  (indoutpt = n w), fe
                    g sam1 = e(sample)
                    
                    ** IVREG2 
                    eststo e2: xi: ivreg2 lwage emp cap i.id (indoutpt = n w)
                    g sam2 = e(sample)
                    
                    ** IVREG2 Centered
                    eststo e3: ivreg2 c_lwage c_emp c_cap (c_indoutpt = c_n c_w)
                    g sam3 = e(sample)
                        
                    ** RESULTS
                    esttab e1 e2 e3 , drop(_Iid*)
                    
                    ** HETTEST
                    gunique id if sam3
                    local N = r(N)
                    local M = r(J)
                    local S = (`N'-`M')/`N'
                    di `S'
                    estimates restore e3
                    ivhettest
                    local chi2a = r(ph)*`S'
                    di "Given-chi2 = " %5.3f r(ph) " (prob = " %5.3f r(php) ")"
                    di "Adj-chi2   = " %5.3f `chi2a' " (prob = " %5.3f chi2tail(4,`chi2a') ")"
                    
                    ** REDUCE HETERO BY LOG WAGE
                    ** XTIVREG2
                    eststo e1: xtivreg2 lwage emp cap  (indoutpt = n w), fe
                    
                    ** IVREG2 
                    eststo e2: xi: ivreg2 lwage emp cap i.id (indoutpt = n w)
                    
                    ** IVREG2 Centered
                    eststo e3: ivreg2 c_lwage c_emp c_cap (c_indoutpt = c_n c_w)
                    replace sam3 = e(sample)
                        
                    ** RESULTS
                    esttab e1 e2 e3 , drop(_Iid*)
                    
                    ** HETTEST
                    gunique id if sam3
                    local N = r(N)
                    local M = r(J)
                    local S = (`N'-`M')/`N'
                    di `S'
                    estimates restore e3
                    ivhettest
                    local chi2a = r(ph)*`S'
                    di "Given-chi2 = " %5.3f r(ph) " (prob = " %5.3f r(php) ")"
                    di "Adj-chi2   = " %5.3f `chi2a' " (prob = " %5.3f chi2tail(4,`chi2a') ")"
                    Last edited by George Ford; 22 Feb 2023, 13:11.

                    Comment


                    • #11
                      Hi George! The code above and below

                      Code:
                       
                       ** REDUCE HETERO BY LOG WAGE
                      produce the same test statistics. Is this supposed to be like that?

                      What you are showing is the manual calculation of the Pagan-Hall general test statistic, isnt it?

                      How do I compute the Breusch-Pagan/Godfrey/Cook-Weisberg test statistic in a similar manner?

                      Comment


                      • #12
                        I don't get the same statistics. Much lower prob for the log model.

                        if you want the BPGCW test stat, then
                        ivhettest, bpg

                        But note the Chi2 is valid only under homoskedasticity.

                        Comment


                        • #13
                          Thanks!

                          I still dont understand how to obtain a valid BPGCW test stat for a fixed effects model?

                          Simply run the RE model with fixed effect dummies, take the statistics from - ivhettest, bpg - and use the same correction factor as (N-M)/N ?


                          Comment


                          • #14
                            Code:
                            clear
                            cd S:\STATA
                            use https://www.stata-press.com/data/r17/abdata.dta
                            
                            xtset id year
                            g lwage = ln(wage)
                            
                            ** CENTER VARIABLES
                            foreach var in wage lwage emp cap indoutpt n w {
                                 bys id: center `var' , g(c_`var')
                                }
                                
                            ** XTIVREG2
                            eststo e1: xtivreg2 lwage emp cap  (indoutpt = n w), fe
                            g sam1 = e(sample)
                            
                            ** IVREG2 
                            eststo e2: xi: ivreg2 lwage emp cap i.id (indoutpt = n w)
                            g sam2 = e(sample)
                            
                            ** IVREG2 Centered
                            eststo e3: ivreg2 c_lwage c_emp c_cap (c_indoutpt = c_n c_w)
                            g sam3 = e(sample)
                                
                            ** RESULTS
                            esttab e1 e2 e3 , drop(_Iid*)
                            
                            ** HETTEST
                            gunique id if sam3
                            local N = r(N)
                            local M = r(J)
                            local S = (`N'-`M')/`N'
                            di `S'
                            estimates restore e3
                            ivhettest , bpg
                            local chi2a = r(bpg)*`S'
                            di "Given-chi2 = " %5.3f r(bpg) " (prob = " %5.3f r(bpgp) ")"
                            di "Adj-chi2   = " %5.3f `chi2a' " (prob = " %5.3f chi2tail(4,`chi2a') ")"
                            
                            ** REDUCE HETERO BY LOG WAGE
                            ** XTIVREG2
                            eststo e1: xtivreg2 lwage emp cap  (indoutpt = n w), fe
                            
                            ** IVREG2 
                            eststo e2: xi: ivreg2 lwage emp cap i.id (indoutpt = n w)
                            
                            ** IVREG2 Centered
                            eststo e3: ivreg2 c_lwage c_emp c_cap (c_indoutpt = c_n c_w)
                            replace sam3 = e(sample)
                                
                            ** RESULTS
                            esttab e1 e2 e3 , drop(_Iid*)
                            
                            ** HETTEST
                            gunique id if sam3
                            local N = r(N)
                            local M = r(J)
                            local S = (`N'-`M')/`N'
                            di `S'
                            estimates restore e3
                            ivhettest , bpg
                            local chi2a = r(bpg)*`S'
                            di "Given-chi2 = " %5.3f r(bpg) " (prob = " %5.3f r(bpgp) ")"
                            di "Adj-chi2   = " %5.3f `chi2a' " (prob = " %5.3f chi2tail(4,`chi2a') ")"

                            Comment

                            Working...
                            X