# Testing for heteroskedasticity in panel data vs time series?

I watched this video on how to check for heteroskedasticity using Stata, and it helped me a lot. But the data example in the video was time series data.

He used the Bruesh-Pagan test.

hettest dependntvar1 dependvar2 dependvar3 ... dv6


And the output was like

Breusch-Pagan / Cook-Weisberg test for heteroskedasticity
Ho: Constant variance
Variables: dependntvar1 dependvar2 dependvar3 ... dv6

chi2(6)     =  86.56
Prob > chi2  =   0.0000


Does it work the same for panel data?

If not, how do I test for heteroskedasticity on panel data?

• In stata, you can test for heteroskedasticity of panel data specifically. The following link may help. stata.com/support/faqs/statistics/… – DornerA Mar 25 '16 at 13:03
• @DornerA, yeah that was very helpful, thank you. But a little too technical for me to fully digest it. Is there dumbed-down explanation somewhere? Or one with pictures/graphs? maybe that would help even more. – user4207 Mar 26 '16 at 0:28

You can regress residual squares (from RE or FE depending on your estimation) on $X_{it} \hat\beta$ and its square using the clustered standard errors (the vce(cl id) option), and read the F statistic and the associated p value. This is basically the same as Het test for cross sectional models (White's simplified test).

xtreg y x1 x2, re
predict uhat, ue
predict xb, xb
gen uhatsq = uhat^2
reg uhatsq c.xb##c.xb, vce(cl id)
testparm c.xb##c.xb


Another test is for groupwise heteroskedasticity proposed by Greene (2000). This test assumes that the variance of the error term is $\sigma_i^2$ (no heteroskedasticity over $t$) and then test whether $\sigma_i^2$ is the same for all $i$. You can do it using the xttest3 module. The xttest3 manual says:

In terms of small sample properties, simulations of the test statistic have shown that its power is very low in the context of fixed effects with "large N, small T" panels. In that circumstance, the test should be used with caution.
{"ft_lang_label":"__label__en","ft_lang_prob":0.7637623,"math_prob":0.8420331,"size":588,"snap":"2019-51-2020-05","text_gpt3_token_len":177,"char_repetition_ratio":0.15582192,"word_repetition_ratio":0.021276595,"special_character_ratio":0.2568027,"punctuation_ratio":0.15966387,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9582166,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-01-19T02:57:36Z\",\"WARC-Record-ID\":\"<urn:uuid:89ff0fb0-184b-48d5-86e8-558768f1c64a>\",\"Content-Length\":\"133130\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:e6ccace1-bcf3-4720-b5ee-28f1354bbf5f>\",\"WARC-Concurrent-To\":\"<urn:uuid:0f390d71-2e4a-456e-9c4d-3dc0e1dd4770>\",\"WARC-IP-Address\":\"151.101.65.69\",\"WARC-Target-URI\":\"https://economics.stackexchange.com/questions/11221/testing-for-heteroskedasticity-in-panel-data-vs-time-series\",\"WARC-Payload-Digest\":\"sha1:6CXSMSGQB54KHQZ4G4RB6HPPVZXSRDZL\",\"WARC-Block-Digest\":\"sha1:IOKXB4VOTXQYYUALG54UEXYT57LNNWX5\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-05/CC-MAIN-2020-05_segments_1579250594101.10_warc_CC-MAIN-20200119010920-20200119034920-00032.warc.gz\"}"}