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 |
Maarten buis <maartenbuis@yahoo.co.uk> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Set constraint for a ml equation |

Date |
Tue, 4 May 2010 07:00:03 +0000 (GMT) |

--- On Mon, 3/5/10, Yuyan Shi wrote: > 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')) <snip> This line looks odd to me: you are constraining mu to be positive, while the normal distribution is defined for positive and negative numbers > 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"? Depends on your research question, your theory, your knowledge about the context, your knowledge about existing practice in your particular discipline, your knowledge about the data. In short, this is a substantive question that can only be answered by the researcher. > - If I know delta is between 1 and 2, how should I > write this extra constraint? Is "invlogit" the > appropriate function? Yes you can use the -invlogit- function to transform a number that ranges from -large to +large to a number that ranges from 0 to 1 (exclusive), you can than use multiplication to change the range and addition to shift it up or down. I can't say I understand the logic behind your model, but if identification is the problem then a range constraint is usually not enough to identify the model and you'll most likely have to contrain delta to a fixed number rather than estimate. To do so, you can use the -constraint- program and option, see -help constraint-. Hope this helps, Maarten -------------------------- Maarten L. Buis Institut fuer Soziologie Universitaet Tuebingen Wilhelmstrasse 36 72074 Tuebingen Germany http://www.maartenbuis.nl -------------------------- * * 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/

**References**:**st: Set constraint for a ml equation***From:*"Yuyan Shi" <shiyuyan@gmail.com>

- Prev by Date:
**RE: st: how to find the integral for a portion of a normal distribution.** - Next by Date:
**st: AW: how to find the integral for a portion of a normal distribution.** - Previous by thread:
**st: Set constraint for a ml equation** - Next by thread:
**st: Computing effect size for a clustered randomized control trial** - Index(es):