* * Example 11.2 from pp 220-221 * White and related standard errors * open data tablef9-1[1].txt data(format=prn,org=columns) 1 100 mdr acc age income avgexp ownrent selfempl * set incomesq = income**2 set posexp = avgexp>0 * * OLS with homoscedastic std errors * linreg(smpl=posexp) avgexp # constant age income incomesq ownrent * * Test exclusion of income and incomesq * exclude(title="Test with OLS standard errors") # income incomesq * * Standard "White" covariance matrix * linreg(smpl=posexp,robusterrors) avgexp # constant age income incomesq ownrent * * Repeat test on the income variables * exclude(title="Test with White standard errors") # income incomesq * * Rescaled. The LINREG with the options CREATE and LASTREG prints a new regression output * for the last regression with an altered covariance matrix or coefficient vector. In this * case, we replace the covariance matrix with a rescaled version. * linreg(create,lastreg,form=chisquared,$ covmat=%xx*(float(%nobs)/%ndf),$ title="OLS with DM(1) Standard Errors") * * Redo the standard linreg * linreg(smpl=posexp,noprint) avgexp / resids # constant age income incomesq ownrent * * This computes the x inv(X'X) x' series needed for the Davidson and MacKinnon covariance * matrix calculations. * prj(xvx=xvx) set resdm = resids/sqrt(1-xvx) mcov(lastreg) / resdm linreg(create,lastreg,form=chisquared,$ covmat=%xx*%cmom*%xx,$ title="OLS with DM(2) Standard Errors")