Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# st: Set constraint for a ml equation

 From "Yuyan Shi" To Subject st: Set constraint for a ml equation Date Mon, 3 May 2010 18:53:44 -0400

```Hi all,

I am estimating "mu", "sigma" and "delta" in a ml function like this:

Log likelihood = log(normalden(N/delta)),
Where N = pi-1+normal((ti-mu)/sigma). pi and ti are dependent variables.

The Stata program I wrote is:

******************************************************
program define myml
args lnf lgmu lgsigma lgdelta
tempvar P R N M S

quietly gen double `P' = normal((\$ML_y1-exp(`lgmu'))/exp(`lgsigma'))
quietly gen double `R' = \$ML_y2-1
quietly gen double `N' = `P'+`R'
quietly gen double `M' = exp(`lgdelta')
quietly gen double `S' = log(normalden(`N'/`M'))
quietly replace `lnf'=`S'
end
ml model lf myml (lgmu:Y1 Y2=\$xvar) (lgsigma:Y1 Y2=\$xvar) (lgdelta:Y1
Y2=\$zvar)
ml max
**************************************************************

However, the convergence cannot be achieved. I know I should put some
constraints onto lgdelta for identification. I've tried several in equation
"lgdelta", such as noconstant, xvar=some arbitrary number, but still did not
work.

I have two separate question:
-	What kind of constraint should I put in equation "lgdelta"?
-	If I know delta is between 1 and 2, how should I write this extra
constraint? Is "invlogit" the appropriate function?

Thank you so much.

-  Yuyan

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```