{smcl} {com}{sf}{ul off}{txt}{.-} log: {res}C:\Documents and Settings\jli2\My Documents\Log\MLE_log\Linear_414.smcl {txt}log type: {res}smcl {txt}opened on: {res}29 Sep 2004, 14:54:40 {txt} {com}. * linear regression model . * Wooldridge textbook, page 80, exercise 4.14 . use http://fmwww.bc.edu/ec-p/data/wooldridge/ATTEND {txt} {com}. * use "canned command--regress" to run regression . regress stndfnl atndrte frosh soph {txt}Source {c |} SS df MS Number of obs ={res} 680 {txt}{hline 13}{char +}{hline 30} F( 3, 676) ={res} 6.74 {txt} Model {char |} {res} 19.3023743 3 6.43412478 {txt}Prob > F = {res} 0.0002 {txt}Residual {char |} {res} 645.461067 676 .954824063 {txt}R-squared = {res} 0.0290 {txt}{hline 13}{char +}{hline 30} Adj R-squared = {res} 0.0247 {txt} Total {char |} {res} 664.763441 679 .97903305 {txt}Root MSE = {res} .97715 {txt}{hline 13}{c TT}{hline 64} stndfnl {c |} Coef. Std. Err. t P>|t| [95% Conf. Interval] {hline 13}{char +}{hline 64} atndrte {c |} {res} .0081634 .0022031 3.71 0.000 .0038376 .0124892 {txt} frosh {c |} {res}-.2898943 .1157244 -2.51 0.012 -.5171167 -.0626719 {txt} soph {c |} {res}-.1184455 .0990267 -1.20 0.232 -.3128824 .0759913 {txt} _cons {c |} {res}-.5017308 .1963139 -2.56 0.011 -.8871892 -.1162724 {txt}{hline 13}{c BT}{hline 64} {com}. * use self-defined maximum likelihood estimator . program define linear_regress {txt} 1{com}. args lnf theta1 theta2 {txt} 2{com}. quietly replace `lnf'=-0.5*ln(`theta2')-($ML_y1-`theta1')^2/(2*`theta2') {txt} 3{com}. end {txt} {com}. ml model lf linear_regress ( stndfnl= atndrte frosh soph) () {txt} {com}. ml maximize {txt}initial: log likelihood = {res} -{txt} (could not be evaluated) feasible: log likelihood = {res}-579.52351 {txt}rescale: log likelihood = {res}-579.52351 {txt}rescale eq: log likelihood = {res}-332.38258 {txt}Iteration 0: log likelihood = {res}-332.38258{txt} Iteration 1: log likelihood = {res}-322.63624{txt} Iteration 2: log likelihood = {res}-322.27735{txt} Iteration 3: log likelihood = {res}-322.27651{txt} Iteration 4: log likelihood = {res}-322.27651{txt} {col 51}Number of obs{col 67}= {res} 680 {col 51}{txt}Wald chi2({res}3{txt}){col 67}= {res} 20.34 {txt}Log likelihood = {res}-322.27651{col 51}{txt}Prob > chi2{col 67}= {res} 0.0001 {txt}{hline 13}{c TT}{hline 64} stndfnl {c |} Coef. Std. Err. z P>|z| [95% Conf. Interval] {hline 13}{c +}{hline 64} {res}eq1 {txt}{c |} atndrte {c |} {res} .0081634 .0021966 3.72 0.000 .0038581 .0124687 {txt}frosh {c |} {res}-.2898943 .1153835 -2.51 0.012 -.5160418 -.0637468 {txt}soph {c |} {res}-.1184455 .098735 -1.20 0.230 -.3119626 .0750715 {txt}_cons {c |} {res}-.5017308 .1957357 -2.56 0.010 -.8853657 -.1180959 {txt}{hline 13}{c +}{hline 64} {res}eq2 {txt}{c |} _cons {c |} {res} .9492075 .051478 18.44 0.000 .8483124 1.050103 {txt}{hline 13}{c BT}{hline 64} {com}. * in the same fashion, you can try exercise 4.13 on page 80 . log close {txt}log: {res}C:\Documents and Settings\jli2\My Documents\Log\MLE_log\Linear_414.smcl {txt}log type: {res}smcl {txt}closed on: {res}29 Sep 2004, 15:01:56 {txt}{.-} {smcl} {txt}{sf}{ul off}