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

Re: st: RE: simulated maximum likelihood estimation


From   "Erik Ø. Sørensen" <sameos@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: simulated maximum likelihood estimation
Date   Tue, 10 May 2005 10:03:44 +0200

On 9. mai. 2005, at 20.13, Jun Xu wrote:
       qui gen double `ed`i'' = -ln(uniform())*`b'
It seems to me that you draw new random numbers for each evaluation.
I don't think you should draw new random numbers each time. If you do so, your likelihood function will never be smooth and you cannot hope to use gradient based methods to maximise it.

You should instead first draw a number of random variates, and pass these on to the evaluator as if they were data. Alternatively, I guess you could set the seed to be a constant everytime my_ll is called.

Best regards,
Erik.





qui replace `sp`i''= `sp`j''*(invlogit( `xb'+`ed`i'')) if $ML_y1 == 1
qui replace `sp`i''= `sp`j''*(invlogit(-(`xb'+`ed`i''))) if $ML_y1 == 0
}

qui replace `lnf' = ln(`sp100')
end

use binlfp2.dta, clear
ml model lf my_ll (lfp = k5 k618 age), technique(nr bhhh dfp bfgs)
ml search
ml maximize

**************************************************

Jun Xu
Ph.D. Candidate
Department of Sociology
Indiana University at Bloomington
http://mypage.iu.edu/~junxu/home





From: "Nick Cox" <n.j.cox@durham.ac.uk>
Reply-To: statalist@hsphsun2.harvard.edu
To: <statalist@hsphsun2.harvard.edu>
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
n.j.cox@durham.ac.uk

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/
_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/

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

--
Erik Ø. Sørensen, dept of Econ., Norwegian School of Economics
phone: (+47) 55959985 [office], <http://homepage.mac.com/sameos/research/>



--
Erik Ø. Sørensen, dept of Econ., Norwegian School of Economics
phone: (+47) 55959985 [office], <http://homepage.mac.com/sameos/research/>


*
* 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index