capture log close log using bk_rep8.log, replace // This do file produces the results used as the basis for the note // Replicating the results in ``on efficient estimation with panel data: // an empirical comparison of instrumental variables estimators" // Journal of Applied Econometrics Vol 18, Issue 1 page 119. // // For the most part the results and the article should be self-explanatory. // There are two exceptions. // // 1) The constants reported in the orginal paper by Baltagi and // Khanti-Akom were not GLS adjusted. In constrast, -xthausman- perform // the GLS transform on the constant as is does to all the other // covariates. // // 2) Some to the results for the Hausman tests obtained here differ from // those published in the original published by Baltagi and Khanti-Akom. // These differences are due to difference tolernances used in computing // the generalized matrix inverse. // version 8.0 clear set mem 10m use cornyrup2 set matsize 800 tsset id t /* This section replicates columns GLS, Within, HT, and AM from * Table I */ /* Reproduce Table I column Within results */ xtreg lwage wks south smsa ms exp exp2 occ ind union , fe estimates store xtreg_fe1 /* Reproduce Table I column HT results */ xthtaylor lwage wks south smsa ms exp exp2 occ ind union fem blk ed, /// endog(exp exp2 occ ind union ed) estimates store xtht1 di " e(sigma_u)^2 = " e(sigma_u)^2 di " e(sigma_e)^2 = " e(sigma_e)^2 local theta = 1- sqrt((e(sigma_e)^2)/(7*e(sigma_u)^2+ e(sigma_e)^2 ) ) hausman xtreg_fe1 xtht1 /* Table I column AM results */ xthtaylor lwage wks south smsa ms exp exp2 occ ind union fem blk ed, /// endog(exp exp2 occ ind union ed) amacurdy estimates store xtam1 hausman xtht1 xtam1 local ratio = e(sigma_u)/e(sigma_e) /* Reproduce Table I column GLS results */ xtdata lwage wks south smsa ms exp exp2 occ ind union fem blk ed ,/* */ re ratio(`ratio') clear regress lwage wks south smsa ms exp exp2 occ ind union fem blk ed /* Note these GLS results differ from what one gets using Swamy-Arora * estimates of the variance components produced below * because the ratio of sigma_u/sigma_e is not the Swamy-Arora estimate. */ use cornyrup2, clear tsset id t xtreg lwage wks south smsa ms exp exp2 occ ind union fem blk ed , re /* This section reproduces the results from columns GLS, Within, HT and AM from * Table II */ use cornyrup2, clear tsset id t /* Reproduce Table II column Within results */ // xtreg lwage wks south smsa ms exp exp2 occ ind union , fe xtreg lwage occ south smsa ind exp exp2 wks ms union, fe /* Reproduce Table II column HT results */ xthtaylor lwage occ south smsa ind exp exp2 wks ms union fem blk ed, /// endog(exp exp2 wks ms union ed) estimates store xtht2 hausman xtreg_fe1 xtht2 di " e(sigma_u)^2 = " e(sigma_u)^2 di " e(sigma_e)^2 = " e(sigma_e)^2 local theta = 1- sqrt((e(sigma_e)^2)/(7*e(sigma_u)^2+ e(sigma_e)^2 ) ) /* Reproduce Table II column AM results */ xthtaylor lwage occ south smsa ind exp exp2 wks ms union fem blk ed, /// endog(exp exp2 wks ms union ed) amacurdy estimates store xtam2 hausman xtht2 xtam2 local ratio = e(sigma_u)/e(sigma_e) /* Reproduce Table II column GLS results */ xtdata lwage wks south smsa ms exp exp2 occ ind union fem blk ed ,/* */ re ratio(`ratio') // regress lwage wks south smsa ms exp exp2 occ ind union fem blk ed regress lwage occ south smsa ind exp exp2 wks ms union fem blk ed /* Note these GLS results differ from what one gets using Swamy-Arora * estimates of the variance components produced below * because the assumed ratio of sigma_u/sigma_e is not the Swamy-Arora * estimate */ use cornyrup2, clear tsset id t xtreg lwage wks south smsa ms exp exp2 occ ind union fem blk ed , re /* This section replicates the results in Columns (Within and HT) of * Table III */ use cornyrup2, clear tsset id t xtreg lwage wks south smsa ms exp2 occ ind union tdum1-tdum6, fe /* Begin long hand calculation that replicated HT column of Table III */ local sig_e2 = .023 local sig_u2 = .256 local theta = 1- sqrt(`sig_e2'/(7*`sig_u2'+`sig_e2' ) ) local x1list "wks south smsa ms tdum1 tdum2 tdum3 tdum4 tdum5 tdum6" local x2list "exp exp2 occ ind union" local z1list "fem blk" local z2list "ed" by id: egen double lwage_b = mean(lwage) gen double lwage_gls = lwage-`theta'*lwage_b foreach var of local x1list { by id: egen double `var'_b = mean(`var') gen double `var'_w = `var'-`var'_b gen double `var'_gls = `var'- `theta'*`var'_b } foreach var of local x2list { by id: egen double `var'_b = mean(`var') gen double `var'_w = `var'-`var'_b gen double `var'_gls = `var'- `theta'*`var'_b } foreach var of local z1list { by id: egen double `var'_b = mean(`var') gen double `var'_w = `var'-`var'_b gen double `var'_gls = `var'- `theta'*`var'_b } foreach var of local z2list { by id: egen double `var'_b = mean(`var') gen double `var'_w = `var'-`var'_b gen double `var'_gls = `var'- `theta'*`var'_b } /* Reproduce Table III column HT results */ ivreg lwage_gls wks_gls south_gls smsa_gls ms_gls fem_gls blk_gls /* */ tdum1_gls tdum2_gls tdum3_gls tdum4_gls tdum5_gls tdum6_gls /* */ ( exp_gls exp2_gls occ_gls ind_gls union_gls /* */ ed_gls = wks_w south_w smsa_w ms_w exp_w exp2_w occ_w ind_w /* */ tdum1_w tdum2_w tdum3_w tdum4_w tdum5_w tdum6_w /* */ tdum1_b tdum2_b tdum3_b tdum4_b tdum5_b tdum6_b /* */ union_w wks_b south_b smsa_b ms_b fem blk) /* end long hand calculation of column HT Table III results */ /* The following section proposes new results for the HT and AM column of * Table III */ xtreg lwage wks south smsa ms tdum1-tdum6 exp2 occ ind union, fe estimates store xtfe2 xthtaylor lwage wks south smsa ms exp exp2 occ ind union fem blk ed /// tdum1-tdum3, endog(exp exp2 occ ind union ed) estimates store xtht3 di " e(sigma_u)^2 = " e(sigma_u)^2 di " e(sigma_e)^2 = " e(sigma_e)^2 hausman xtfe2 xtht3 xthtaylor lwage wks south smsa ms exp exp2 occ ind union fem blk ed /// tdum1-tdum3, endog(exp exp2 occ ind union ed) amacurdy log close