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

st: RE: simulated maximum likelihood estimation


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: simulated maximum likelihood estimation
Date   Mon, 9 May 2005 01:11:33 +0100

I am not sure exactly what you are trying 
to do here. It is usually better to set 
up a log likelihood function directly. What
you are logging here does not have the usual 
form of a likelihood function. 

Nick 
[email protected] 

Jun Xu
 
> I am not sure if some expert could give me some hint about 
> where to go. Here 
> I am trying to estimate a logit with an added expotential 
> distributed random 
> error (with mean of 5). I am using simualted mle with 100 
> replications, but 
> cannot get it converged. Not sure if I had a correct setup.
> 
> 
> set trace off
> set more off
> cap program drop my_ll
> program my_ll
>     version 8.2
>     args lnf xb
>     tempname b
>     sca `b' = 5
> 
>     forval j = 1/100 {
>         tempname ed`j'
>     }
> 
>     qui replace `lnf' = 0
>     forval i = 1/100 {
>         qui gen double `ed`i'' = -ln(uniform())*`b'
>         qui replace `lnf'= `lnf' + invlogit( `xb'+`ed`i'')    
>   if $ML_y1 == 
> 1
>         qui replace `lnf'= `lnf' + invlogit(-(`xb'+`ed`i''))  
>   if $ML_y1 == 
> 0
>     }
> 
>     qui replace `lnf' = ln(`lnf')
> end
> 
> use binlfp2.dta, clear
> ml model lf my_ll (lfp = k5 k618 age), technique(nr bhhh dfp bfgs)
> ml maximize
> 
> 
> initial:       log likelihood =   2948.488
> alternative:   log likelihood =  2952.4599
> rescale:       log likelihood =  2952.4599
> (setting optimization to Newton-Raphson)
> numerical derivatives are approximate
> flat or discontinuous region encountered
> Iteration 0:   log likelihood =  2949.0411  (not concave)
> numerical derivatives are approximate
> flat or discontinuous region encountered
> Iteration 1:   log likelihood =  2950.7797  (not concave)
> numerical derivatives are approximate
> flat or discontinuous region encountered
> no observations
> r(2000);
> 

*
*   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