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]

st: Changes in ML d2 routine between v10 and v11


From   Patrick Eozenou <[email protected]>
To   [email protected]
Subject   st: Changes in ML d2 routine between v10 and v11
Date   Mon, 18 Oct 2010 21:22:49 -0400

Dear Statalist,

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.

Thanks in advance for any input.

Patrick Eozenou

****************************code starts here ***************************
program drop _all
version 11            /* Change this to version 10 to get convergence */
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
****************************code ends here ***************************
*
*   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