Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: maximum likelihood procedures for oprobit


From   "Sunhwa Lee" <[email protected]>
To   Richard Williams <[email protected]>, [email protected]
Subject   Re: st: maximum likelihood procedures for oprobit
Date   Wed, 7 Dec 2005 22:29:41 -0800 (PST)

Thanks...I see your point. The reason I used auto.dta is just to save some 
time as it takes a while to converge with my dataset. I know my program 
can produce the same estimates as with oprobit as long as non-dummies go. 
However, if my program were written in the exactly same way as 
in "oprobit" code, shouldn't the estimates be identical for the dummy 
variables (that are of main interest) as well? 

It looks like my sample dataset will illustrate the problem better. Below 
is a test code with my sample data and the data is attached. This time, 
the difference in the dummies across the three models (oprobit, ml program 
with ml default tolerance levels and ml program with stata internal 
tolerance levels) is more drastic. Furthermore, iteration processes are a 
bit different. While oprobit converges nicely, the other two models 
encounter "non concave" message during iteration. 
Thank you for your help again!

Sunhwa

/*****************************/
use ml_oprobit, clear
local RHS i.boc i.reg une i.st  i.period inc_med_ln-p_edu_grad
xi: oprobit n  `RHS', robust cluster(zipcode)
testparm  inc_med_ln-_Iperiod_8

outreg using test2.xls,  nolabel  replace
capture program drop myoprobit
    program define myoprobit
    version 8.0
    args lnf xb  t0 t2 t4 
    tempvar p0 p2 p4 p9
    quietly gen double `p0'=ln(norm(`t0'-`xb'))
    quietly gen double `p2'=ln(norm(`t2'-`xb')-norm(`t0'-`xb'))
    quietly gen double `p4'=ln(norm(`t4'-`xb')-norm(`t2'-`xb'))
    quietly gen double `p9'=ln(norm(-`t4'+`xb'))
    quietly replace `lnf'=($ML_y1==0)*`p0' + ($ML_y1==2)*`p2' /*
*/ +($ML_y1==4)*`p4'+($ML_y1==9)*`p9'
    end

/********* with ml default tolerance ****************/
xi: ml model lf myoprobit (n = `RHS', nocons) /*
        */ (tau1: ) (tau2:) (tau3:), robust cluster(zipcode)
ml search
ml maximize
testparm  inc_med_ln-_Iperiod_8
outreg using test2.xls,  nolabel  append

/********* with stata internal tolerance ****************/
xi: ml model lf myoprobit (n = `RHS', nocons) /*
        */ (tau1: ) (tau2:) (tau3:), robust cluster(zipcode)
ml search
ml maximize, tolerance(1e-4) ltolerance(0)
testparm  inc_med_ln-_Iperiod_8
outreg using test2.xls,  nolabel  append
/**********************************************/


> At 11:04 PM 12/7/2005, Sunhwa Lee wrote:
> >Thanks a lot for the quick reply.
> >-- I tried that code myself to find the same error message.
> >-- I am using Ver.8
> >-- oprobit is attached this time with -ml-.
> >
> >Here is attached again the right code that has just been tested okay.
> 
> I think it is a problem with the data more than the program.  This 
> simpler model works fine.  Note that the testparm command after 
> oprobit gives you a Wald chi-square, which you can then compare with 
> the results from your program.
> 
> . oprobit rep mpg foreign
> 
> Iteration 0:   log likelihood = -97.440603
> Iteration 1:   log likelihood = -82.871392
> Iteration 2:   log likelihood = -82.681234
> Iteration 3:   log likelihood = -82.680255
> Iteration 4:   log likelihood = -82.680255
> 
> Ordered probit regression                         Number of obs   
=       
>  74
>                                                    LR chi2(2)      =     
> 29.52
>                                                    Prob > chi2     =    
> 0.0000
> Log likelihood = -82.680255                       Pseudo R2       =    
> 0.1515
> 
> -------------------------------------------------------------------------
-----
>         rep78 |      Coef.   Std. Err.      z    P>|z|     [95% Conf.
> Interval]
> -------------+-----------------------------------------------------------
-----
>           mpg |   .0445906   .0255612     1.74   0.081    -.0055083   
> .0946896
>       foreign |    1.37699   .3275072     4.20   0.000     .7350882   
> 2.018893
> -------------+-----------------------------------------------------------
-----
>         /cut1 |   .2926372   .5296403                     -.7454387   
> 1.330713
>         /cut2 |   1.631237   .5418085                      .5693114   
> 2.693162
>         /cut3 |   2.731538    .607935                      1.540007   
> 3.923069
> -------------------------------------------------------------------------
-----
> 
> . testparm *
> 
>   ( 1)  [rep78]mpg = 0
>   ( 2)  [rep78]foreign = 0
> 
>             chi2(  2) =   26.87
>           Prob > chi2 =    0.0000
> 
> . ml model lf myoprobit (rep =mpg foreign, nocons)(tau1: ) (tau2:)
> (tau3:),
> .
> . ml maximize
> 
> initial:       log likelihood =     -<inf>  (could not be evaluated)
> feasible:      log likelihood = -4165.2347
> rescale:       log likelihood = -162.36841
> rescale eq:    log likelihood = -98.148979
> Iteration 0:   log likelihood = -98.148979
> Iteration 1:   log likelihood = -83.137823
> Iteration 2:   log likelihood = -82.682056
> Iteration 3:   log likelihood = -82.680255
> Iteration 4:   log likelihood = -82.680255
> 
>                                                    Number of obs   
=      
>   74
>                                                    Wald chi2(2)    =     
> 26.87
> Log likelihood = -82.680255                       Prob > chi2     =    
> 0.0000
> 
> -------------------------------------------------------------------------
-----
>         rep78 |      Coef.   Std. Err.      z    P>|z|     [95% Conf.
> Interval]
> -------------+-----------------------------------------------------------
-----
> eq1          |
>           mpg |   .0445907   .0255612     1.74   0.081    -.0055083   
> .0946896
>       foreign |    1.37699   .3275072     4.20   0.000     .7350882   
> 2.018893
> -------------+-----------------------------------------------------------
-----
> tau1         |
>         _cons |   .2926377   .5296404     0.55   0.581    -.7454384   
> 1.330714
> -------------+-----------------------------------------------------------
-----
> tau2         |
>         _cons |   1.631237   .5418086     3.01   0.003     .5693117   
> 2.693163
> -------------+-----------------------------------------------------------
-----
> tau3         |
>         _cons |   2.731539   .6079352     4.49   0.000     1.540008    
> 3.92307
> -------------------------------------------------------------------------
-----
> 
> 
> 
> -------------------------------------------
> Richard Williams, Notre Dame Dept of Sociology
> OFFICE: (574)631-6668, (574)631-6463
> FAX:    (574)288-4373
> HOME:   (574)289-5227
> EMAIL:  [email protected]
> WWW (personal):    http://www.nd.edu/~rwilliam
> WWW (department):    http://www.nd.edu/~soc 
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 

**************************************
Lee, Sunhwa
PhD Candidate
Department of Economics
University of California at Davis
Davis, CA, 95616
(Office) 109 SSH
(Phone) (530)752-2845
**************************************
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index