Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Changes in ML d2 routine between v10 and v11


From   Patrick Eozenou <[email protected]>
To   [email protected]
Subject   Re: st: Changes in ML d2 routine between v10 and v11
Date   Tue, 19 Oct 2010 11:13:00 -0400

Hi Jeffrey,

I have just tried running the code again with -version 11- and -ml
maximize, negh- as suggested, but the routine keeps iterating on the
same non-concave value. Is there anything I am not seeing?

***************** starts here ********************

program drop _all
version 11
program myprobit_d2
args todo b lnf g negH
tempvar xb lj g1
mleval `xb' = `b'
quietly {
	gen double `lj' = normal( `xb') if $ML_y1 == 1
	replace `lj' 	= normal(-`xb') if $ML_y1 == 0
	mlsum `lnf' = ln(`lj')
	if (`todo' == 0 | `lnf' >= .) exit
	
	gen double `g1' =  normalden(`xb')/`lj' if $ML_y1 == 1
	replace    `g1' = -normalden(`xb')/`lj' if $ML_y1 == 0
	mlvecsum `lnf' `g' = `g1', eq(1)
	if (`todo' == 0 | `lnf' >= .) exit
	
	mlmatsum `lnf' `negH' = `g1'*(`g1'*`xb'), eq(1,1)
	
}
end

clear
set obs 1000
set seed 12345
gen x = invnormal(uniform())
gen y = (0.5 + 0.5*x > invnormal(uniform()))

ml model d2 myprobit_d2 (y = x)
ml search
ml maximize, negh
probit y x

********************************* ends here ***************************

Regards,

Patrick

On Tue, Oct 19, 2010 at 9:22 AM, Patrick Eozenou
<[email protected]> wrote:
> Great. Thanks for the fast and sharp reply.
>
> Regards,
>
> Patrick
>
> On Mon, Oct 18, 2010 at 11:04 PM, Jeffrey Pitblado <[email protected]> wrote:
>> Patrick Eozenou <[email protected]> is using an -ml- evaluator written
>> prior to Stata 11 and noticed that when the evaluator is used in Stata 11,
>> without version control, the result no convergance and a lot of "(not
>> concave)" messages:
>>
>>> I am playing with method d2 of -ml- and found out a difference in
>>> execution between version 10 and version 9. The following probit
>>> likelihood evaluator reaches a solution if run under version 10, but
>>> it remains stuck on a (not concave) value under version 11. I am just
>>> curious as to why this is the case.
>>
>> The probit evaluator Partick posted returns the negative of the Hessian
>> matrix, which was required by -ml- prior to Stata 11.
>>
>> The optimization engine that -ml- uses in Stata 11 now assumes that -d2-
>> evaluators return the Hessian matrix, Patrick can use the -negh- option to
>> tell -ml- that the evaluator returns the negative of the Hessian matrix.
>>
>> --Jeff Pitblado
>>  [email protected]
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/statalist/faq
>> *   http://www.ats.ucla.edu/stat/stata/
>>
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index