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

st: attention ml experts -- please help


From   Ed Blackburne <[email protected]>
To   [email protected]
Subject   st: attention ml experts -- please help
Date   Thu, 23 Sep 2004 08:39:29 -0500

I am trying to understand ml hold and ml unhold to use in a complicated procedure. Nothing seems to work, so I have included a simple, contrived example to see if someone can help.

<>My two do files defining my ml models:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
capture program drop mypmg_ec
program define mypmg_ec
version 8.2
args lnf beta
local y $ML_y1
ml hold
ml model lf mypmg_all (junk: `y'= weight, offset(`beta') nocons) /sigma
quie ml max
ml unhold
quietly replace `lnf' = e(ll)
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
capture program drop mypmg_all
program define mypmg_all
version 8.2
args lnf thetas sigma
tempvar z
local y $ML_y1
quie gen double `z' = `y'-`thetas'
quietly replace `lnf' = ln(normd(`z'/exp(`sigma')))-`sigma'
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

To replicate my problem using auto.dta:

<>I want to estimate the (approximately) equivalent of regress price disp weight, nocons <>The code fragment is:

use auto

ml model lf mypmg_ec(price=displ, nocons)

ml max

<>The problem is the ml routine seems to converge to a max, but continually “backs up” and, as far as Stata is concerned, will not converge.

Here is the resulting output:

<>

. ml model lf mypmg_ec (price=mpg, nocons)

. ml max

initial: log likelihood = -50544.621

alternative: log likelihood = -50544.609

rescale: log likelihood = -50543.178

Iteration 0: log likelihood = -50543.178

Iteration 1: log likelihood = -50543.177 (backed up)

Iteration 2: log likelihood = -50543.177 (backed up)

Iteration 3: log likelihood = -50543.177 (backed up)

Iteration 4: log likelihood = -50543.177 (backed up)

Iteration 5: log likelihood = -50543.177 (backed up)

Iteration 6: log likelihood = -50543.177 (backed up)

Iteration 7: log likelihood = -50543.177 (backed up)

This is course continues without convergence.

Any suggestions??

<>

Thank you for any and all help!

<><>Ed Blackburne
Associate Professor
Economics and International Business
Sam Houston State University
[email protected]
*
* 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