{smcl} {com}{sf}{ul off}{txt}{.-} log: {res}C:\Documents and Settings\jli2\My Documents\Log\MLE_log\order_probit.smcl {txt}log type: {res}smcl {txt}opened on: {res}29 Sep 2004, 21:07:34 {txt} {com}. * order probit model . * we use the data from stata official website . use http://www.stata-press.com/data/r8/fullauto {txt}(Automobile Models) {com}. * we need to look at how the variable "rep77" is labeled. . des {txt}Contains data from {res}http://www.stata-press.com/data/r8/fullauto.dta {txt} obs:{res} 74 Automobile Models {txt} vars:{res} 18 3 Sep 2002 12:25 {txt} size:{res} 3,700{txt} (99.6% of memory free) {hline 79} storage display value variable name type format label variable label {hline 79} {res}make {txt} int %8.0g make {res}Make model {txt} int %8.0g model {res}Model price {txt} int %8.0g {res}Price mpg {txt} int %8.0g {res}Mileage (mpg) rep78 {txt} int %9.0g repair {res}Repair Record 1978 rep77 {txt} int %9.0g repair {res}Repair Record 1977 hdroom {txt} float %6.1f {res}Headroom (in.) rseat {txt} float %6.1f {res}Rear Seat (in.) trunk {txt} int %8.0g {res}Trunk space (cu. ft.) weight {txt} int %8.0g {res}Weight (lbs.) length {txt} int %8.0g {res}Length (in.) turn {txt} int %8.0g {res}Turn Circle (ft.) displ {txt} int %8.0g {res}Displacement (cu. in.) gratio {txt} float %6.2f {res}Gear Ratio order {txt} int %8.0g {res}Original order foreign {txt} int %8.0g foreign {res}Foreign wgtd {txt} float %9.0g {res} wgtf {txt} float %9.0g {res} {txt}{hline 79} Sorted by: {res}make model {txt} {com}. label list repair {txt}repair: {res} 1 Poor 2 Fair 3 Average 4 Good 5 Excellent {txt} {com}. * run the canned "oprobit" routine . oprobit rep77 foreign length mpg {txt}Iteration 0: log likelihood = {res}-89.895098 {txt}Iteration 1: log likelihood = {res}-78.141221 {txt}Iteration 2: log likelihood = {res}-78.020314 {txt}Iteration 3: log likelihood = {res}-78.020025 {txt}Ordered probit estimates Number of obs = {res} 66 {txt}LR chi2({res}3{txt}) = {res} 23.75 {txt}Prob > chi2 = {res} 0.0000 {txt}Log likelihood = {res}-78.020025 {txt}Pseudo R2 = {res} 0.1321 {txt}{hline 13}{c TT}{hline 64} rep77 {c |} Coef. Std. Err. z P>|z| [95% Conf. Interval] {hline 13}{c +}{hline 64} foreign {c |} {res} 1.704861 .4246786 4.01 0.000 .8725057 2.537215 {txt}length {c |} {res} .0468675 .012648 3.71 0.000 .022078 .0716571 {txt}mpg {c |} {res} .1304559 .0378627 3.45 0.001 .0562464 .2046654 {txt}{hline 13}{c +}{hline 64} _cut1 {c |} {res} 10.1589 3.076749 {txt}(Ancillary parameters) _cut2 {c |} {res} 11.21003 3.107522 {txt}_cut3 {c |} {res} 12.54561 3.155228 {txt}_cut4 {c |} {res} 13.98059 3.218786 {txt}{hline 13}{c BT}{hline 64} {com}. * user-defined MLE procedure . program drop _all {txt} {com}. program define orderprobit_stata {txt} 1{com}. args lnf theta1 theta2 theta3 theta4 theta5 {txt} 2{com}. quietly replace `lnf'=ln(norm(`theta2'-`theta1')) if $ML_y1==1 {txt} 3{com}. quietly replace `lnf'=ln(norm(`theta3'-`theta1')-norm(`theta2'-`theta1')) if $ML_y1==2 {txt} 4{com}. quietly replace `lnf'=ln(norm(`theta4'-`theta1')-norm(`theta3'-`theta1')) if $ML_y1==3 {txt} 5{com}. quietly replace `lnf'=ln(norm(`theta5'-`theta1')-norm(`theta4'-`theta1')) if $ML_y1==4 {txt} 6{com}. quietly replace `lnf'=ln(1-norm(`theta5'-`theta1')) if $ML_y1==5 {txt} 7{com}. end {txt} {com}. ml model lf orderprobit_stata ( rep77= foreign length mpg,noconstant) () () () () {txt} {com}. ml maximize {txt}initial: log likelihood = {res} -{txt} (could not be evaluated) feasible: log likelihood = {res} -452.7671 {txt}rescale: log likelihood = {res}-191.63415 {txt}rescale eq: log likelihood = {res}-180.53523 {txt}Iteration 0: log likelihood = {res}-180.53523{txt} Iteration 1: log likelihood = {res}-101.92816{txt} Iteration 2: log likelihood = {res} -79.26036{txt} Iteration 3: log likelihood = {res}-78.106616{txt} Iteration 4: log likelihood = {res}-78.020063{txt} Iteration 5: log likelihood = {res}-78.020025{txt} Iteration 6: log likelihood = {res}-78.020025{txt} {col 51}Number of obs{col 67}= {res} 66 {col 51}{txt}Wald chi2({res}3{txt}){col 67}= {res} 21.93 {txt}Log likelihood = {res}-78.020025{col 51}{txt}Prob > chi2{col 67}= {res} 0.0001 {txt}{hline 13}{c TT}{hline 64} rep77 {c |} Coef. Std. Err. z P>|z| [95% Conf. Interval] {hline 13}{c +}{hline 64} {res}eq1 {txt}{c |} foreign {c |} {res} 1.704861 .4246799 4.01 0.000 .8725037 2.537218 {txt}length {c |} {res} .0468676 .012648 3.71 0.000 .0220779 .0716572 {txt}mpg {c |} {res} .130456 .0378628 3.45 0.001 .0562463 .2046657 {txt}{hline 13}{c +}{hline 64} {res}eq2 {txt}{c |} _cons {c |} {res} 10.15891 3.076759 3.30 0.001 4.128573 16.18925 {txt}{hline 13}{c +}{hline 64} {res}eq3 {txt}{c |} _cons {c |} {res} 11.21004 3.107531 3.61 0.000 5.119386 17.30068 {txt}{hline 13}{c +}{hline 64} {res}eq4 {txt}{c |} _cons {c |} {res} 12.54562 3.155238 3.98 0.000 6.361463 18.72977 {txt}{hline 13}{c +}{hline 64} {res}eq5 {txt}{c |} _cons {c |} {res} 13.9806 3.218798 4.34 0.000 7.671871 20.28933 {txt}{hline 13}{c BT}{hline 64} {com}. * remark 1: we need the option "noconstant" . * remark 2: this is a five-equation model . log close {txt}log: {res}C:\Documents and Settings\jli2\My Documents\Log\MLE_log\order_probit.smcl {txt}log type: {res}smcl {txt}closed on: {res}29 Sep 2004, 21:12:39 {txt}{.-} {smcl} {txt}{sf}{ul off}