* * Heteroscedasticity tests on pages 212-215. * open data food.dat data(format=free,org=columns) 1 40 food income * order(ranks=ranks) income * linreg(smpl=ranks<=20) food # constant income compute rsslow=%rss,ndflow=%ndf linreg(smpl=ranks>20) food # constant income compute rsshigh=%rss,ndfhigh=%ndf compute gqstat=(rsshigh/ndfhigh)/(rsslow/ndflow) cdf(title="Goldfeld-Quandt Test based upon income") ftest gqstat ndfhigh ndflow * * Breusch-Pagan and White tests done through auxiliary regressions * linreg food # constant income set usq = %resids^2 linreg usq # constant income cdf(title="Breusch-Pagan heteroscedasticity test") chisqr %trsquared 1 set incsq = income^2 linreg usq # constant income incsq cdf(title="White heteroscedasticity test") chisqr %trsquared 2 * * Same tests done using the RegWhiteTest procedure. With type=bp, it does the * Breusch-Pagan test, and with type=full it does the White test. (There are * several other options which can be used when there are many explanatory * variables making the full set of interactions too large to handle). * linreg food # constant income @regwhitetest(type=bp) @regwhitetest(type=full)