------------------------------------------------------------------------------------------------------------------------------------ log: c:\stataproject\micrometrics\hw8\hw8.log log type: text opened on: 13 Jan 2003, 23:45:14 . use C:\stataproject\micrometrics\hw8\labsup.dta,clear; . des; Contains data from C:\stataproject\micrometrics\hw8\labsup.dta obs: 31,857 vars: 19 2 Jan 2002 10:01 size: 1,019,424 (95.1% of memory free) ------------------------------------------------------------------------------- storage display value variable name type format label variable label ------------------------------------------------------------------------------- kidcount byte %8.0g number of kids morekids byte %8.0g had more than 2 kids boys2 byte %8.0g first two births boys girls2 byte %8.0g first two births girls boy1st byte %8.0g first birth boy boy2nd byte %8.0g second birth boy samesex byte %8.0g first two kids are of same sex multi2nd byte %8.0g =1 if 2nd birth is twin age byte %8.0g age of mom agefstm byte %8.0g age of mom at first birth black byte %8.0g =1 of black hispan byte %8.0g =1 if hispanic worked byte %8.0g mom worked last year weeks byte %8.0g weeks worked mom hours byte %8.0g hours of work per week, mom labinc float %9.0g mom's labor income, $1000s faminc float %9.0g family income, $1000s nonmomi float %9.0g 'non-mom' income, $1000s educ byte %8.0g moms years of education ------------------------------------------------------------------------------- Sorted by: . *1.1; . reg worked morekids edu age nonmomi,robust; Regression with robust standard errors Number of obs = 31857 F( 4, 31852) = 574.83 Prob > F = 0.0000 R-squared = 0.0629 Root MSE = .47619 ------------------------------------------------------------------------------ | Robust worked | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- morekids | -.1068855 .0055662 -19.20 0.000 -.1177955 -.0959754 educ | .0290699 .0008461 34.36 0.000 .0274116 .0307283 age | .0111272 .0007708 14.44 0.000 .0096164 .0126381 nonmomi | -.001568 .00014 -11.20 0.000 -.0018424 -.0012937 _cons | .0412085 .0231078 1.78 0.075 -.0040836 .0865006 ------------------------------------------------------------------------------ . *1.2; . ivreg worked (morekids=samesex) edu age nonmomi,robust; IV (2SLS) regression with robust standard errors Number of obs = 31857 F( 4, 31852) = 460.14 Prob > F = 0.0000 R-squared = 0.0523 Root MSE = .47886 ------------------------------------------------------------------------------ | Robust worked | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- morekids | -.211591 .0976281 -2.17 0.030 -.4029458 -.0202361 educ | .0256331 .0033109 7.74 0.000 .0191437 .0321226 age | .0134746 .0023175 5.81 0.000 .0089323 .0180169 nonmomi | -.0016778 .0001736 -9.66 0.000 -.0020181 -.0013375 _cons | .0641142 .0315552 2.03 0.042 .0022649 .1259635 ------------------------------------------------------------------------------ Instrumented: morekids Instruments: educ age nonmomi samesex ------------------------------------------------------------------------------ . *1.3; . probit worked morekids edu age nonmomi; Iteration 0: log likelihood = -21565.093 Iteration 1: log likelihood = -20541.797 Iteration 2: log likelihood = -20539.675 Iteration 3: log likelihood = -20539.675 Probit estimates Number of obs = 31857 LR chi2(4) = 2050.84 Prob > chi2 = 0.0000 Log likelihood = -20539.675 Pseudo R2 = 0.0475 ------------------------------------------------------------------------------ worked | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- morekids | -.2863907 .0149402 -19.17 0.000 -.315673 -.2571084 educ | .0777668 .0023396 33.24 0.000 .0731813 .0823523 age | .0300889 .0020588 14.61 0.000 .0260538 .0341241 nonmomi | -.0042076 .0003656 -11.51 0.000 -.0049241 -.0034911 _cons | -1.238736 .0624851 -19.82 0.000 -1.361204 -1.116267 ------------------------------------------------------------------------------ . dprobit worked morekids edu age nonmomi; Iteration 0: log likelihood = -21565.093 Iteration 1: log likelihood = -20541.797 Iteration 2: log likelihood = -20539.675 Iteration 3: log likelihood = -20539.675 Probit estimates Number of obs = 31857 LR chi2(4) =2050.84 Prob > chi2 = 0.0000 Log likelihood = -20539.675 Pseudo R2 = 0.0475 ------------------------------------------------------------------------------ worked | dF/dx Std. Err. z P>|z| x-bar [ 95% C.I. ] ---------+-------------------------------------------------------------------- morekids*| -.1107794 .0057436 -19.17 0.000 .491007 -.122037 -.099522 educ | .0301599 .0009073 33.24 0.000 11.0053 .028382 .031938 age | .0116692 .0007983 14.61 0.000 29.7418 .010105 .013234 nonmomi | -.0016318 .0001418 -11.51 0.000 31.7618 -.00191 -.001354 ---------+-------------------------------------------------------------------- obs. P | .5897919 pred. P | .5939629 (at x-bar) ------------------------------------------------------------------------------ (*) dF/dx is for discrete change of dummy variable from 0 to 1 z and P>|z| are the test of the underlying coefficient being 0 . *1.4; . reg morekids samesex edu age nonmomi; Source | SS df MS Number of obs = 31857 -------------+------------------------------ F( 4, 31852) = 611.73 Model | 567.99388 4 141.99847 Prob > F = 0.0000 Residual | 7393.67954 31852 .232126069 R-squared = 0.0713 -------------+------------------------------ Adj R-squared = 0.0712 Total | 7961.67342 31856 .249926966 Root MSE = .48179 ------------------------------------------------------------------------------ morekids | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- samesex | .0549646 .0053989 10.18 0.000 .0443825 .0655467 educ | -.032804 .0008415 -38.98 0.000 -.0344533 -.0311547 age | .0224201 .000761 29.46 0.000 .0209285 .0239116 nonmomi | -.0010581 .0001372 -7.71 0.000 -.001327 -.0007892 _cons | .191186 .0234222 8.16 0.000 .1452776 .2370944 ------------------------------------------------------------------------------ . predict vhat,residual; . probit worked morekids edu age nonmomi vhat; Iteration 0: log likelihood = -21565.093 Iteration 1: log likelihood = -20541.223 Iteration 2: log likelihood = -20539.096 Iteration 3: log likelihood = -20539.096 Probit estimates Number of obs = 31857 LR chi2(5) = 2051.99 Prob > chi2 = 0.0000 Log likelihood = -20539.096 Pseudo R2 = 0.0476 ------------------------------------------------------------------------------ worked | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- morekids | -.5689111 .2630916 -2.16 0.031 -1.084561 -.053261 educ | .0684947 .0089312 7.67 0.000 .0509898 .0859996 age | .0364244 .00624 5.84 0.000 .0241942 .0486547 nonmomi | -.0045039 .0004577 -9.84 0.000 -.005401 -.0036067 vhat | .2834179 .2634977 1.08 0.282 -.233028 .7998638 _cons | -1.176988 .0848429 -13.87 0.000 -1.343277 -1.010699 ------------------------------------------------------------------------------ . *1.5; . *Before implementing the IV probit estimation, see whether own written probit works fine.; . *maximum likelihood estimation; . cap program drop myprobit; . program define myprobit; 1. version 7; 2. args lnf theta; 3. quietly replace `lnf' = > ln(normprob(`theta')) if $ML_y1==1; 4. quietly replace `lnf' = > ln(1-normprob(`theta')) if $ML_y1==0; 5. end; . ml model lf myprobit (worked=morekids edu age nonmomi); . ml maximize; initial: log likelihood = -22081.59 alternative: log likelihood = -22298.949 rescale: log likelihood = -21570.349 Iteration 0: log likelihood = -21570.349 Iteration 1: log likelihood = -20541.6 Iteration 2: log likelihood = -20539.675 Iteration 3: log likelihood = -20539.675 Number of obs = 31857 Wald chi2(4) = 1968.30 Log likelihood = -20539.675 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ worked | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- morekids | -.2863907 .0149402 -19.17 0.000 -.315673 -.2571084 educ | .0777668 .0023396 33.24 0.000 .0731813 .0823523 age | .0300889 .0020588 14.61 0.000 .0260538 .0341241 nonmomi | -.0042076 .0003656 -11.51 0.000 -.0049241 -.0034911 _cons | -1.238736 .0624851 -19.82 0.000 -1.361204 -1.116267 ------------------------------------------------------------------------------ . probit worked morekids edu age nonmomi; Iteration 0: log likelihood = -21565.093 Iteration 1: log likelihood = -20541.797 Iteration 2: log likelihood = -20539.675 Iteration 3: log likelihood = -20539.675 Probit estimates Number of obs = 31857 LR chi2(4) = 2050.84 Prob > chi2 = 0.0000 Log likelihood = -20539.675 Pseudo R2 = 0.0475 ------------------------------------------------------------------------------ worked | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- morekids | -.2863907 .0149402 -19.17 0.000 -.315673 -.2571084 educ | .0777668 .0023396 33.24 0.000 .0731813 .0823523 age | .0300889 .0020588 14.61 0.000 .0260538 .0341241 nonmomi | -.0042076 .0003656 -11.51 0.000 -.0049241 -.0034911 _cons | -1.238736 .0624851 -19.82 0.000 -1.361204 -1.116267 ------------------------------------------------------------------------------ . *The results are exactly same; . *Implementing IV probit estimation; . *Since treating y2 as binary variable is not trivial, I assume y2 is conditionally normally distributed.; . *Note that this assumption cannot be true when y2 is binary. Thus this is a short-cut and dirty answer; . *Model; . * y1 = 1(x delta + alpha1 y2 + e > 0); . * y2 = z theta + v; . * (e,v)|x ~ N(Ee=0,Ev=0,var(e)=1,var(v)=tau2^2,corr(e,v)=rho1); . * x=[edu age nonmomi], z=[samesex edu age nonmomi]; . * x delta is called as `delta' in the following estimation.; . * z theta is called as `theta' in the following estimation.; . *See Wooldridge's "Econometric Analysis of Cross Section and Panel Data", p476, equation (15.50) for likelihood function.; . *maximum likelihood estimation; . cap program drop ivprobit; . program define ivprobit; 1. version 7; 2. args lnf delta theta alpha1 tau2 rho1; 3. quietly replace `lnf' = > ln(normprob((`delta'+`alpha1'*morekids+ > (`rho1'/`tau2')*(morekids -`theta'))/(1-`rho1'^2)^(1/2))) > -ln(`tau2') - (1/2)*(morekids-`theta')^2/`tau2'^2 > if $ML_y1==1; 4. quietly replace `lnf' = > ln(1-normprob((`delta'+`alpha1'*morekids+ > (`rho1'/`tau2')*(morekids -`theta'))/(1-`rho1'^2)^(1/2))) > -ln(`tau2') - (1/2)*(morekids-`theta')^2/`tau2'^2 > if $ML_y1==0; 5. end; . ml model lf ivprobit (y1:worked = edu age nonmomi) (y2:samesex edu age nonmomi) (alpha1:) (tau2:) (rho1:); . ml maximize; initial: log likelihood = - (could not be evaluated) feasible: log likelihood = -29176.893 rescale: log likelihood = -29176.893 rescale eq: log likelihood = -15131.712 Iteration 0: log likelihood = -15131.712 (not concave) Iteration 1: log likelihood = -14491.356 (not concave) Iteration 2: log likelihood = -14224.538 (not concave) Iteration 3: log likelihood = -14068.11 (not concave) Iteration 4: log likelihood = -13916.848 (not concave) Iteration 5: log likelihood = -13590.58 (not concave) Iteration 6: log likelihood = -13566.622 (not concave) Iteration 7: log likelihood = -13549.019 (not concave) Iteration 8: log likelihood = -13534.412 (not concave) Iteration 9: log likelihood = -13521.685 (not concave) Iteration 10: log likelihood = -13510.335 (not concave) Iteration 11: log likelihood = -13500.11 (not concave) Iteration 12: log likelihood = -13490.762 (not concave) Iteration 13: log likelihood = -13482.112 (not concave) Iteration 14: log likelihood = -13474.043 (not concave) Iteration 15: log likelihood = -13466.453 (not concave) Iteration 16: log likelihood = -13459.27 (not concave) Iteration 17: log likelihood = -13452.434 (not concave) Iteration 18: log likelihood = -13445.906 (not concave) Iteration 19: log likelihood = -13439.645 (not concave) Iteration 20: log likelihood = -13433.627 (not concave) Iteration 21: log likelihood = -13427.825 (not concave) Iteration 22: log likelihood = -13422.225 (not concave) Iteration 23: log likelihood = -13416.807 (not concave) Iteration 24: log likelihood = -13411.56 (not concave) Iteration 25: log likelihood = -13406.473 (not concave) Iteration 26: log likelihood = -13401.536 (not concave) Iteration 27: log likelihood = -13396.74 (not concave) Iteration 28: log likelihood = -13392.079 (not concave) Iteration 29: log likelihood = -13387.546 (not concave) Iteration 30: log likelihood = -13383.136 (not concave) Iteration 31: log likelihood = -13378.844 (not concave) Iteration 32: log likelihood = -13374.664 (not concave) Iteration 33: log likelihood = -13370.593 (not concave) Iteration 34: log likelihood = -13366.628 (not concave) Iteration 35: log likelihood = -13362.763 (not concave) Iteration 36: log likelihood = -13358.997 (not concave) Iteration 37: log likelihood = -13355.325 (not concave) Iteration 38: log likelihood = -13351.746 (not concave) Iteration 39: log likelihood = -13348.256 (not concave) Iteration 40: log likelihood = -13344.852 (not concave) Iteration 41: log likelihood = -13341.533 (not concave) Iteration 42: log likelihood = -13338.295 (not concave) Iteration 43: log likelihood = -13335.137 (not concave) Iteration 44: log likelihood = -13332.056 (not concave) Iteration 45: log likelihood = -13329.05 (not concave) Iteration 46: log likelihood = -13326.117 (not concave) Iteration 47: log likelihood = -13323.255 (not concave) Iteration 48: log likelihood = -13320.462 (not concave) Iteration 49: log likelihood = -13317.737 (not concave) Iteration 50: log likelihood = -13315.078 (not concave) Iteration 51: log likelihood = -13312.482 (not concave) Iteration 52: log likelihood = -13309.948 (not concave) Iteration 53: log likelihood = -13307.475 (not concave) Iteration 54: log likelihood = -13305.062 (not concave) Iteration 55: log likelihood = -13302.705 (not concave) Iteration 56: log likelihood = -13300.405 (not concave) Iteration 57: log likelihood = -13298.16 (not concave) Iteration 58: log likelihood = -13295.968 (not concave) Iteration 59: log likelihood = -13293.827 (not concave) Iteration 60: log likelihood = -13291.738 (not concave) Iteration 61: log likelihood = -13289.697 (not concave) Iteration 62: log likelihood = -13287.705 (not concave) Iteration 63: log likelihood = -13285.759 (not concave) Iteration 64: log likelihood = -13283.86 (not concave) Iteration 65: log likelihood = -13282.005 (not concave) Iteration 66: log likelihood = -13280.193 (not concave) Iteration 67: log likelihood = -13278.424 (not concave) Iteration 68: log likelihood = -13276.696 (not concave) Iteration 69: log likelihood = -13275.009 (not concave) Iteration 70: log likelihood = -13273.361 (not concave) Iteration 71: log likelihood = -13271.751 (not concave) Iteration 72: log likelihood = -13270.179 (not concave) Iteration 73: log likelihood = -13268.644 (not concave) Iteration 74: log likelihood = -13267.144 (not concave) Iteration 75: log likelihood = -13265.679 (not concave) Iteration 76: log likelihood = -13264.248 (not concave) Iteration 77: log likelihood = -13262.849 (not concave) Iteration 78: log likelihood = -13261.484 (not concave) Iteration 79: log likelihood = -13260.15 (not concave) Iteration 80: log likelihood = -13258.847 (not concave) Iteration 81: log likelihood = -13257.573 (not concave) Iteration 82: log likelihood = -13256.329 (not concave) Iteration 83: log likelihood = -13255.114 (not concave) Iteration 84: log likelihood = -13253.927 (not concave) Iteration 85: log likelihood = -13252.767 (not concave) Iteration 86: log likelihood = -13251.634 (not concave) Iteration 87: log likelihood = -13250.527 (not concave) Iteration 88: log likelihood = -13249.445 (not concave) Iteration 89: log likelihood = -13248.388 (not concave) Iteration 90: log likelihood = -13247.355 (not concave) Iteration 91: log likelihood = -13246.346 (not concave) Iteration 92: log likelihood = -13245.36 (not concave) Iteration 93: log likelihood = -13244.396 (not concave) Iteration 94: log likelihood = -13243.455 (not concave) Iteration 95: log likelihood = -13242.535 (not concave) Iteration 96: log likelihood = -13241.636 (not concave) Iteration 97: log likelihood = -13240.757 (not concave) Iteration 98: log likelihood = -13239.899 (not concave) Iteration 99: log likelihood = -13239.06 (not concave) Iteration 100: log likelihood = -13238.24 (not concave) Iteration 101: log likelihood = -13237.439 (not concave) Iteration 102: log likelihood = -13236.656 (not concave) Iteration 103: log likelihood = -13235.891 (not concave) Iteration 104: log likelihood = -13235.144 (not concave) Iteration 105: log likelihood = -13234.413 (not concave) Iteration 106: log likelihood = -13233.699 (not concave) Iteration 107: log likelihood = -13233.001 (not concave) Iteration 108: log likelihood = -13232.319 (not concave) Iteration 109: log likelihood = -13231.653 (not concave) Iteration 110: log likelihood = -13231.001 (not concave) Iteration 111: log likelihood = -13230.365 (not concave) Iteration 112: log likelihood = -13229.742 (not concave) Iteration 113: log likelihood = -13229.134 (not concave) Iteration 114: log likelihood = -13228.54 (not concave) Iteration 115: log likelihood = -13227.959 (not concave) Iteration 116: log likelihood = -13227.391 (not concave) Iteration 117: log likelihood = -13226.836 (not concave) Iteration 118: log likelihood = -13226.294 (not concave) Iteration 119: log likelihood = -13225.764 (not concave) Iteration 120: log likelihood = -13225.246 (not concave) Iteration 121: log likelihood = -13224.739 Iteration 122: log likelihood = -13219.814 (backed up) Iteration 123: log likelihood = -13202.454 Iteration 124: log likelihood = -13202.002 Iteration 125: log likelihood = -13201.926 Iteration 126: log likelihood = -13201.925 Number of obs = 31857 Wald chi2(3) = 1047.85 Log likelihood = -13201.925 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ worked | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- y1 | educ | .0678652 .0100232 6.77 0.000 .04822 .0875104 age | .0360897 .0056377 6.40 0.000 .02504 .0471393 nonmomi | -.0044625 .0004146 -10.76 0.000 -.0052752 -.0036498 _cons | -1.16617 .099122 -11.76 0.000 -1.360445 -.9718943 -------------+---------------------------------------------------------------- y2 | samesex | .0549647 .0053985 10.18 0.000 .0443838 .0655456 educ | -.032804 .0008414 -38.99 0.000 -.0344531 -.0311549 age | .0224201 .0007609 29.46 0.000 .0209287 .0239115 nonmomi | -.0010581 .0001372 -7.71 0.000 -.001327 -.0007892 _cons | .1911859 .0234204 8.16 0.000 .1452829 .237089 -------------+---------------------------------------------------------------- alpha1 | _cons | -.5636821 .252487 -2.23 0.026 -1.058548 -.0688167 -------------+---------------------------------------------------------------- tau2 | _cons | .4817568 .0019086 252.42 0.000 .4780161 .4854976 -------------+---------------------------------------------------------------- rho1 | _cons | .1352836 .124155 1.09 0.276 -.1080558 .3786229 ------------------------------------------------------------------------------ . *confirmation of the correctness of the second equation; . reg morekids samesex edu age nonmomi; Source | SS df MS Number of obs = 31857 -------------+------------------------------ F( 4, 31852) = 611.73 Model | 567.99388 4 141.99847 Prob > F = 0.0000 Residual | 7393.67954 31852 .232126069 R-squared = 0.0713 -------------+------------------------------ Adj R-squared = 0.0712 Total | 7961.67342 31856 .249926966 Root MSE = .48179 ------------------------------------------------------------------------------ morekids | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- samesex | .0549646 .0053989 10.18 0.000 .0443825 .0655467 educ | -.032804 .0008415 -38.98 0.000 -.0344533 -.0311547 age | .0224201 .000761 29.46 0.000 .0209285 .0239116 nonmomi | -.0010581 .0001372 -7.71 0.000 -.001327 -.0007892 _cons | .191186 .0234222 8.16 0.000 .1452776 .2370944 ------------------------------------------------------------------------------ . log close; log: c:\stataproject\micrometrics\hw8\hw8.log log type: text closed on: 14 Jan 2003, 00:05:10 ------------------------------------------------------------------------------------------------------------------------------------