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 20:04:56 -0800 (PST)

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.

Sunhwa

/****** ML Programs for Oprobit Replication *************/

clear
sysuse auto
replace rep=2 if rep==. | rep==1
replace rep=rep-1

/****** oprobit ******/
xi: oprobit rep mpg i.turn
outreg using auto.xls, nolabel replace

/********** myoprobit1 **************/

capture program drop myoprobit1
    program define myoprobit1
    args lnf xb  t1 t2 t3
    tempvar p1 p2 p3 p4
    qui gen double `p1'=ln(norm(`t1'-`xb'))
    qui gen double `p2'=ln(norm(`t2'-`xb')-norm(`t1'-`xb'))
    qui gen double `p3'=ln(norm(`t3'-`xb')-norm(`t2'-`xb'))
    qui gen double `p4'=ln(norm(-`t3'+`xb'))
    qui replace `lnf'=($ML_y1==1)*`p1' + ($ML_y1==2)*`p2' /*
                  */ +($ML_y1==3)*`p3' + ($ML_y1==4)*`p4'
    end

xi: ml model lf myoprobit1 (rep =mpg i.turn, nocons) (t1: ) (t2:) (t3:)
ml maximize
outreg using auto.xls, nolabel  append 



> At 09:29 PM 12/7/2005, Sunhwa Lee wrote:
> >Hello,
> >I am writing an ml program that replicates "oprobit" code in stata. With
> >all many trials, I have not succeeded in getting the exactly identical
> >estimates as with "oprobit" command. Below is the basic program I used
> to
> >compare with oprobit estimates.
> 
> A couple of basic questions:
> 
> * Are you sure you copied the code correctly in your message?  When I 
> run it, I keep getting the error
> 
> +__000008 invalid name
> 
> * What version of Stata are you running?
> 
> * What is the oprobit command you are giving?
> 
> With 74 cases & 20+ dummies being generated, I don't find it too 
> stunning that there would be minor differences.  But it'll be easier 
> to tell once I can actually replicate your results.
> 
> 
> -------------------------------------------
> 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/
>
*
*   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