Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"Yuyan Shi" <shiyuyan@gmail.com> |

To |
<statalist@hsphsun2.harvard.edu> |

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/

**Follow-Ups**:**Re: st: Set constraint for a ml equation***From:*Maarten buis <maartenbuis@yahoo.co.uk>

- Prev by Date:
**RE: st: Calculating Mahalanobis distance** - Next by Date:
**st: Computing effect size for a clustered randomized control trial** - Previous by thread:
**[no subject]** - Next by thread:
**Re: st: Set constraint for a ml equation** - Index(es):