--------------------------------------------------------------------------------- log: d:\courses\ps552\examples\clrp.log log type: text opened on: 19 Apr 2004, 21:08:22 . . ************************************************************ . * . * CLRP Hours by Hourly Fee example . * . * Bert Kritzer . * original May 5, 2001 . * . *********************************************************** . . drop _all . use "D:\COURSES\PS552\EXAMPLES\clrp.dta", clear . . * load hetreg routine . do d:\courses\ps552\examples\hetreg.sta . program define hetreg 1. * . * HETREG: Maximum Likelihood Heteroskedastic Regression . * Version 1.0 . * (c) 1999 by Charles H. Franklin . * Last modified: 6/28/1999 . * 6/29/2000 . * . * Usage: . * These instructions assume you are running Stata and that . * the program hetreg.sta is in the current directory. (e.g. c:\temp) . * To run a heteroskedastic linear regression type: . * . * do hetreg.sta (You only do this once per Stata session) . * . * ml model lf hetreg (Slopes:y=x1 x2 ... xk) (Variance: z1 z2 ... zj) . * ml max . * . * You must . * replace "y" with the name of your dependent variable . * replace "x1 x2 ... xk" with the list of your independent variables . * replace "z1 z2 ... zj" with the list of variables that affect the vari > ance . * . . version 6 2. args llf theta1 theta2 3. quietly replace `llf'=-.5*ln(exp(`theta2'))-.5*(($ML_y1-`theta1')^2)/ex > p(`theta2') 4. end . end of do-file . . * ordinary regression . reg lhours sqstakes lcomplex fedcourt trial duration lyears lspec Source | SS df MS Number of obs = 342 -------------+------------------------------ F( 7, 334) = 32.71 Model | 3634445.74 7 519206.534 Prob > F = 0.0000 Residual | 5302150.1 334 15874.7009 R-squared = 0.4067 -------------+------------------------------ Adj R-squared = 0.3943 Total | 8936595.84 341 26207.0259 Root MSE = 125.99 ------------------------------------------------------------------------------ lhours | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- sqstakes | .5424715 .0471611 11.50 0.000 .4497013 .6352417 lcomplex | 6.907688 6.381423 1.08 0.280 -5.645158 19.46053 fedcourt | 40.20256 15.2287 2.64 0.009 10.2463 70.15881 trial | 12.28214 19.64612 0.63 0.532 -26.36359 50.92787 duration | .0931821 .0202318 4.61 0.000 .0533844 .1329798 lyears | -.4730211 .7935393 -0.60 0.552 -2.033986 1.087944 lspec | -3.631696 3.827524 -0.95 0.343 -11.16079 3.897396 _cons | -72.02984 21.21099 -3.40 0.001 -113.7538 -30.30587 ------------------------------------------------------------------------------ . . * robust standard errors . reg lhours sqstakes lcomplex fedcourt trial duration lyears lspec, robust Regression with robust standard errors Number of obs = 342 F( 7, 334) = 7.90 Prob > F = 0.0000 R-squared = 0.4067 Root MSE = 125.99 ------------------------------------------------------------------------------ | Robust lhours | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- sqstakes | .5424715 .229899 2.36 0.019 .090239 .9947041 lcomplex | 6.907688 5.338922 1.29 0.197 -3.594462 17.40984 fedcourt | 40.20256 15.34248 2.62 0.009 10.02248 70.38263 trial | 12.28214 17.17873 0.71 0.475 -21.51 46.07427 duration | .0931821 .0277154 3.36 0.001 .0386633 .1477009 lyears | -.4730211 .8920338 -0.53 0.596 -2.227734 1.281691 lspec | -3.631696 2.687846 -1.35 0.178 -8.918936 1.655544 _cons | -72.02984 24.52354 -2.94 0.004 -120.2699 -23.78977 ------------------------------------------------------------------------------ . . * ML . ml model lf hetreg (slopes:lhours=sqstakes lcomplex fedcourt trial duration l > years lspec)(variance: sqstakes) . ml max initial: log likelihood = -5398119.5 alternative: log likelihood = -3266588.4 rescale: log likelihood = -2736.567 rescale eq: log likelihood = -2736.5047 Iteration 0: log likelihood = -2736.5047 Iteration 1: log likelihood = -2336.7217 (not concave) Iteration 2: log likelihood = -1987.7422 (not concave) Iteration 3: log likelihood = -1883.469 (not concave) Iteration 4: log likelihood = -1834.654 (not concave) Iteration 5: log likelihood = -1760.017 (not concave) Iteration 6: log likelihood = -1689.7356 Iteration 7: log likelihood = -1608.2289 Iteration 8: log likelihood = -1579.8095 Iteration 9: log likelihood = -1577.3427 Iteration 10: log likelihood = -1577.3406 Iteration 11: log likelihood = -1577.3406 Number of obs = 342 Wald chi2(7) = 114.06 Log likelihood = -1577.3406 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ lhours | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- slopes | sqstakes | .3571359 .0607339 5.88 0.000 .2380997 .4761722 lcomplex | 6.521007 2.237221 2.91 0.004 2.136134 10.90588 fedcourt | 23.84098 5.475651 4.35 0.000 13.1089 34.57306 trial | 20.89751 7.095088 2.95 0.003 6.991397 34.80363 duration | .0215511 .0078708 2.74 0.006 .0061246 .0369776 lyears | -.3439571 .273648 -1.26 0.209 -.8802973 .1923831 lspec | -2.117329 1.208386 -1.75 0.080 -4.485723 .2510647 _cons | -17.07384 8.172695 -2.09 0.037 -33.09203 -1.055653 -------------+---------------------------------------------------------------- variance | sqstakes | .0133957 .0008223 16.29 0.000 .011784 .0150075 _cons | 6.5213 .1295223 50.35 0.000 6.267441 6.775159 ------------------------------------------------------------------------------ . end of do-file . log close log: d:\courses\ps552\examples\clrp.log log type: text closed on: 19 Apr 2004, 21:08:56 ------------------------------------------------------------------------------- Comparison OLS b OLS se H-W se ML b ML se sqstakes 0.542 0.047 0.230 0.357 0.061 lcomplex 6.908 6.381 5.339 6.521 2.237 fedcourt 40.203 15.229 15.342 23.841 5.476 trial 12.282 19.646 17.179 20.898 7.095 duration 0.093 0.020 0.028 0.022 0.008 lyears -0.473 0.794 0.892 -0.344 0.274 lspec -3.632 3.828 2.688 -2.117 1.208 _cons -72.030 21.211 24.524 -17.074 8.173