options crt; ? 5e8 ? Use the style of 5e7, to avoid repeating code for both years dot(value=year) 78 85; print year; in cps.; set n = 550*(year=78) + 534*(year=85); smpl 1,n; olsq lnwage c fe union nonwh hisp ed ex exsq; ? standard SEs regopt(pvprint) whiteht; ? for (c) -- automated White het test olsq(robust) lnwage c fe union nonwh hisp ed ex exsq; ? (a) - het-robust SEs rename @whiteht,whiteht; rename %whiteht pwhiteht; ? save results for comparison regopt(nocalc) whiteht; ? turn het. test diagnostic off for rest ? ? regression weighted by predicted variance ? e2 = @res*@res; olsq e2 c fe union nonwh hisp ed ex exsq; if year=78; then; olsq e2 c nonwh ed ex; ? regression selected for 1978 else; olsq e2 c ed exsq; ? regression selected for 1985 ? hard to make all t-stats > 2 in this... msd @fit; wfe = 1/sqrt(@fit); olsq(weight=wfe) lnwage c fe union nonwh hisp ed ex exsq; ? (b) ? ? Do White het test by hand ? list crosspds v1-v22; v1 = fe*union; v2 = fe*nonwh; v3 = fe*hisp; v4 = fe*ed; v5 = fe*ex; v6 = fe*exsq; v7 = union*nonwh; v8 = union*hisp; v9 = union*ed; v10 = union*ex; v11 = union*exsq; ? note: nonwh*hisp = 0 always. v12 = nonwh*ed; v13 = nonwh*ex; v14 = nonwh*exsq; v15 = hisp*ed; v16 = hisp*ex; v17 = hisp*exsq; v18 = ed*ed; v19 = ed*ex; v20 = ed*exsq; v21 = ex*exsq; v22 = exsq*exsq; ? v19-21 are left out of book... options fast; ? speed up this large regression olsq e2 @rnms crosspds; options nofast; set tr2 = @nob*@rsq; set df = 29; ? 7+22 cdf(chisq,df=df) tr2; ? (c) print whiteht,pwhiteht; ? compare with automated version ? The above test does not reject homoskedasticity for either ? year at the 95% level, so we don't have to make another ? attempt to adjust for heteroskedasticity (good thing, because ? some of the fitted values from this last e2 regression are negative). ? if year=78; then; delete lnwage fe union nonwh hisp ed ex exsq e2 wfe crosspds; enddot;