# RE: st: a problem on convergence of mle

 From "Maarten Buis" To Subject RE: st: a problem on convergence of mle Date Wed, 18 Oct 2006 10:23:38 +0200

```Jian Zhang:
It seems that you have faithfully copied equation 11 to `lnf', however I could
not find where `g' came from.

One simplification that could make it easier for Stata to find the maximum is
possible: -1/2*ln((`sigma')^2) = -1/2*2*ln(`sigma') = -ln(`sigma')

If you are confident the likelihood equation is correct, than using the
difficult option when calling -ml maximize- can sometimes help. See
-help maximize- for more on this option.

HTH,
Maarten

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

--- Jian Zhang wrote:
My loglikelihood function comes from equation 11 of the paper by Carroll,
Dynan and Krane in Review of Economics and Statistics 85(3) 2003,
Here is the program I wrote for the loglikelihood function for equation 11 in their paper.

capture program drop transform1
program transform1
version 9.2
args lnf xb sigma theta
tempvar g
quietly {
gen double `g'=(ln(`theta'*\$ML_y1+sqrt((`theta')^2*(\$ML_y1)^2+1)))/`theta'
replace `lnf'=-1/2*ln((`sigma')^2)-1/2*1/((`sigma')^2)*(`g'-`xb')^2 ///
-1/2*ln(1+(`theta')^2*(\$ML_y1)^2)
}
end
ml model lf transform1 (dependent variable=independent variable ....) /sigma /theta, robust
cluster(groupvar)
ml maximize

When I used the whole sample, the loglikelihood didn't converge.  But when I used a subsample,
it in fact converged.  Thus it seems to me that the log likelihood function is fine.

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