I am trying to estimate intercept and coefficient of individual level observations using -statsby- command and maximum likelihood OLS regression but hitting a rock. The estimations runs but the estimates are not posted in the new dataset created by statsby. Can someone help with ideas on how to navigate through this problem? Examples are giving below:
Code:
clear input float(id year weight treat) 1 0 89.72 1 1 1 90.177 1 1 2 93.59666 1 2 0 84.507 1 2 1 88.757 1 2 2 50.763 1 3 0 73.043 1 3 1 74.603 1 3 2 62.313 1 4 0 82.553 1 4 1 90.303 1 4 2 82.823 1 5 0 96.54 1 5 1 89.697 1 5 2 87.447 1 6 0 29.727 0 6 1 31.58 0 6 2 24.757 0 10 0 75.783 1 10 1 78.18 1 10 2 76.493 1 11 0 61.103 0 11 1 50.513 0 11 2 43.983 0 13 0 87.857 1 13 1 87.857 1 13 2 82.923 1 14 0 89.207 1 14 1 95.277 1 14 2 94.837 1 15 0 61.533 0 15 1 73.033 0 15 2 84.683 0 16 0 50.52 0 16 1 68.203 0 16 2 56.113 0 17 0 56.584 0 17 1 31.377 0 17 2 34.297 0 18 0 45.5 0 18 1 77.753 0 18 2 82.347 0 19 0 67.463 0 19 1 84.133 0 19 2 80.003 0 20 0 50.987 0 20 1 70.95 0 20 2 74.63 0 21 0 38.63 0 21 1 18.337 0 21 2 12.173 0 24 0 60.68 0 24 1 82.293 0 24 2 27.597 0 25 0 68.123 0 25 1 53.49 0 25 2 57.6 0 26 0 78.553 1 26 1 88.923 1 26 2 81.813 1 28 0 45.323 0 28 1 60.793 0 28 2 53.777 0 29 0 77.393 0 29 1 77.323 0 29 2 55.083 0 32 0 65.553 0 32 1 64.63 0 32 2 82.133 0 33 0 79.76 1 33 1 81.077 1 33 2 41.76 1 34 0 36.3 0 34 1 56.59 0 34 2 70.257 0 35 0 65.503 0 35 1 47.75 0 35 2 32.507 0 36 0 69.1 1 36 1 65.66 1 36 2 64.85 1 end
Code:
capture program drop lfols program lfols version 14.1 args lnf xb lnsigma local y "$ML_y1" quietly replace `lnf' = ln(normalden(`y', `xb',exp(`lnsigma'))) end ml model lf lfols (xb: weight = year) (lnsigma:) statsby cons=_b[xb:_cons] slope= _b[xb:year], by(treat id) clear: ml maximize list in 1/10
HTML Code:
treat id cons slope 1. 0 6 . . 2. 0 11 . . 3. 0 15 . . 4. 0 16 . . 5. 0 17 . . 6. 0 18 . . 7. 0 19 . . 8. 0 20 . . 9. 0 21 . . 10. 0 24 . .
Any help will be appreciated.
Regards,
Madu
0 Response to maximum likelihood OLS regression in Statsby
Post a Comment