* refer to table 4.2, page 158 of Greene's Econometric Analysis, edition 4 * the corresponding table of edition 5 is table 17.1 on page 491 * first import data use http://fmwww.bc.edu/ec-p/data/Greene2000/TBL4-1, clear * note that the variable e is actually the independent variable x * assume the conditional distribution is gamma * the coefficient of e is restricted to be one. * this is a two-paremeter restricted MLE model capture program drop mle_gamma program define mle_gamma version 8.0 args lnf theta1 theta2 quietly replace `lnf'=-`theta2'*ln(`theta1')-lngamma(`theta2')+(`theta2'-1)*ln($ML_y1)-$ML_y1/`theta1' end constraint define 1 e=1 ml model lf mle_gamma (y=e) (), constraints(1) ml maximize /* i y e 1 20.5 12 2 31.5 16 3 47.7 18 4 26.2 16 5 44 12 6 8.28 12 7 30.8 16 8 17.2 12 9 19.9 10 10 9.96 12 11 55.8 16 12 25.2 20 13 29 12 14 85.5 16 15 15.1 10 16 28.5 18 17 21.4 16 18 17.7 20 19 6.42 12 20 84.9 16 . capture program drop mle_gamma . program define mle_gamma 1. version 8.0 2. args lnf theta1 theta2 3. quietly replace `lnf'=-`theta2'*ln(`theta1')-lngamma(`theta2')+(`theta2'-1)*ln($ML_y1)-$ML_y1/`theta1' 4. end . . constraint define 1 e=1 . ml model lf mle_gamma (y=e) (), constraints(1) . ml maximize initial: log likelihood = - (could not be evaluated) feasible: log likelihood = -1287.8497 rescale: log likelihood = -109.84554 rescale eq: log likelihood = -87.102313 Iteration 0: log likelihood = -118.44291 (not concave) Iteration 1: log likelihood = -86.296196 Iteration 2: log likelihood = -83.735966 Iteration 3: log likelihood = -83.088558 Iteration 4: log likelihood = -82.924748 Iteration 5: log likelihood = -82.916083 Iteration 6: log likelihood = -82.916049 Iteration 7: log likelihood = -82.916049 Number of obs = 20 Wald chi2(0) = . Log likelihood = -82.916049 Prob > chi2 = . ( 1) [eq1]e = 1 ------------------------------------------------------------------------------ y | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- eq1 | e | 1 . . . . . _cons | -4.718502 2.345027 -2.01 0.044 -9.31467 -.1223335 -------------+---------------------------------------------------------------- eq2 | _cons | 3.150896 .7942619 3.97 0.000 1.594171 4.707621 ------------------------------------------------------------------------------ . end of do-file */