--------------------------------------------------------------------------------- log: C:\Documents and Settings\jlee\My Documents\Teaching\EC671\xtivreg.l > og log type: text opened on: 24 Aug 2007, 01:40:26 . . clear . set memory 40m (40960k) . set more off . . * use abdata.dta, clear . use http://www.stata-press.com/data/r8/nlswork, clear (National Longitudinal Survey. Young Women 14-26 years of age in 1968) . . generate age2 = age^2 (24 missing values generated) . . tsset idcode year panel variable: idcode, 1 to 5159 time variable: year, 68 to 88, but with gaps . * Some commands require tsset. . . * FE without endogeneity correction . xtreg ln_w age* tenure not_smsa union south, fe i(idcode) Fixed-effects (within) regression Number of obs = 19007 Group variable (i): idcode Number of groups = 4134 R-sq: within = 0.1333 Obs per group: min = 1 between = 0.2375 avg = 4.6 overall = 0.2031 max = 12 F(6,14867) = 381.19 corr(u_i, Xb) = 0.2074 Prob > F = 0.0000 ------------------------------------------------------------------------------ ln_wage | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- age | .0311984 .0033902 9.20 0.000 .0245533 .0378436 age2 | -.0003457 .0000543 -6.37 0.000 -.0004522 -.0002393 tenure | .0176205 .0008099 21.76 0.000 .0160331 .0192079 not_smsa | -.0972535 .0125377 -7.76 0.000 -.1218289 -.072678 union | .0975672 .0069844 13.97 0.000 .0838769 .1112576 south | -.0620932 .013327 -4.66 0.000 -.0882158 -.0359706 _cons | 1.091612 .0523126 20.87 0.000 .9890729 1.194151 -------------+---------------------------------------------------------------- sigma_u | .3910683 sigma_e | .25545969 rho | .70091004 (fraction of variance due to u_i) ------------------------------------------------------------------------------ F test that all u_i=0: F(4133, 14867) = 8.31 Prob > F = 0.0000 . . * FE with endogeneity correction . xtivreg ln_w age* not_smsa (tenure = union south), fe i(idcode) Fixed-effects (within) IV regression Number of obs = 19007 Group variable: idcode Number of groups = 4134 R-sq: within = . Obs per group: min = 1 between = 0.1304 avg = 4.6 overall = 0.0897 max = 12 Wald chi2(4) = 147926.58 corr(u_i, Xb) = -0.6843 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ ln_wage | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- tenure | .2403531 .0373419 6.44 0.000 .1671643 .3135419 age | .0118437 .0090032 1.32 0.188 -.0058023 .0294897 age2 | -.0012145 .0001968 -6.17 0.000 -.0016003 -.0008286 not_smsa | -.0167178 .0339236 -0.49 0.622 -.0832069 .0497713 _cons | 1.678287 .1626657 10.32 0.000 1.359468 1.997106 -------------+---------------------------------------------------------------- sigma_u | .70661941 sigma_e | .63029359 rho | .55690561 (fraction of variance due to u_i) ------------------------------------------------------------------------------ F test that all u_i=0: F(4133,14869) = 1.44 Prob > F = 0.0000 ------------------------------------------------------------------------------ Instrumented: tenure Instruments: age age2 not_smsa union south . . * RE with endogeneity correction . generate byte black = (race == 2) . xtivreg ln_w age* not_smsa black (tenure = union birth south), re i(idcode) G2SLS random-effects IV regression Number of obs = 19007 Group variable: idcode Number of groups = 4134 R-sq: within = 0.0664 Obs per group: min = 1 between = 0.2098 avg = 4.6 overall = 0.1463 max = 12 Wald chi2(5) = 1446.37 corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ ln_wage | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- tenure | .1391798 .0078756 17.67 0.000 .123744 .1546157 age | .0279649 .0054182 5.16 0.000 .0173454 .0385843 age2 | -.0008357 .0000871 -9.60 0.000 -.0010063 -.000665 not_smsa | -.2235103 .0111371 -20.07 0.000 -.2453386 -.2016821 black | -.2078613 .0125803 -16.52 0.000 -.2325183 -.1832044 _cons | 1.337684 .0844988 15.83 0.000 1.172069 1.503299 -------------+---------------------------------------------------------------- sigma_u | .36582493 sigma_e | .63031479 rho | .25197078 (fraction of variance due to u_i) ------------------------------------------------------------------------------ Instrumented: tenure Instruments: age age2 not_smsa black union birth_yr south . . * FD with endogeneity correction . xtivreg ln_w age* not_smsa black (tenure = union birth south), fd i(idcode) First-differenced IV regression Number of obs = 5934 Group variable: idcode Number of groups = 3461 R-sq: within = 0.1458 Obs per group: min = 1 between = 0.6293 avg = 4.3 overall = 0.0951 max = 11 chi2(4) = 8.52 corr(u_i, Xb) = -0.4555 Prob > chi2 = 0.0741 ------------------------------------------------------------------------------ d.ln_wage | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- tenure | D1 | .1320532 .0755474 1.75 0.080 -.0160171 .2801234 age | D1 | .0625048 .0267263 2.34 0.019 .0101223 .1148874 age2 | D1 | -.0007977 .0003378 -2.36 0.018 -.0014599 -.0001356 not_smsa | D1 | -.0610653 .0378044 -1.62 0.106 -.1351607 .01303 black | D1 | (dropped) _cons | -.0844901 .0631594 -1.34 0.181 -.2082803 .0393001 -------------+---------------------------------------------------------------- sigma_u | .5360103 sigma_e | .28346454 rho | .78144937 (fraction of variance due to u_i) ------------------------------------------------------------------------------ Instrumented: tenure Instruments: age age2 not_smsa black union birth_yr south . end of do-file . exit, clear