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

RE: st: simulated likelihood again

From   "Jun Xu" <>
Subject   RE: st: simulated likelihood again
Date   Mon, 29 Aug 2005 08:05:25 -0500

Dear Professor Jenkins,

Many thanks!

Jun Xu
Ph.D. Candidate
Department of Sociology
Indiana University at Bloomington

From: Jenkins S P <>
Subject: st: simulated likelihood again
Date: Mon, 29 Aug 2005 12:08:06 +0100 (BST)

On Mon, 29 Aug 2005, statalist-digest wrote:

Date: Sun, 28 Aug 2005 09:42:23 -0500
From: "Jun Xu" <>
Subject: RE: st: maximum simulated likelihood

Dear Professor Jenkins and other listers,

1. Thanks for correcting my incorrect terminology. I should use msl (maximum
simulated likelihood)
2. So I would say that we HAVE to create those random variables outside the
loop first, right?
3. With slight change in the last line, my new code now is
forval i = 1/100 {
tempname ed`i'
gen double `ed`i'' = -ln(uniform()) // just a very ad hoc way of
creating random vars

qui forval i = 1/100 {
replace `sp'= `sp' * (invlogit(`xb' + `ed`i'')) if $ML_y1 == 1
replace `sp'= `sp' * (invlogit(-(`xb' + `ed`i''))) if $ML_y1 == 0

qui replace `lnf' = (ln(`sp')/100)
One more question:
I use simplest lf method. I am not quite sure why I need to have
"qui replace `lnf' = `lnf' + (ln(`sp')/100)" (say Option A) instead of
"qui replace `lnf' = (ln(`sp')/100)" (say Option B). For Option A, I cannot
get it converged. Option B converged. Regardless of the convergence, I am
just wondering which one is right.

Thanks a lot
Jun Xu
Please re-read my last message.

On your (2), the answer was given last time. ("Outside" is the answer.)

On (3), ensure that your code does proper cross-draws averaging. Option B certainly appears not to do it. [Option A may not either -- I don't have the time to check.]

It is not "ad hoc" to create pseudo-random draws using the uniform() function. It not immediately obvious to me, however, why you create `ed`i'' as minus the log of a uniform variate.

Professor Stephen P. Jenkins <>
Institute for Social and Economic Research (ISER)
University of Essex, Colchester CO4 3SQ, UK
Phone: +44 1206 873374. Fax: +44 1206 873151.
Survival Analysis Using Stata:
* For searches and help try:
Express yourself instantly with MSN Messenger! Download today - it's FREE!

* For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index