Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Non-linear MLE programming + inequality constraints


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Non-linear MLE programming + inequality constraints
Date   Thu, 1 Feb 2007 07:20:05 +0000 (GMT)

There is no command in Stata that enables you to use an inequality
constraint. There are tricks you can use. For instance: A variance must
be larger then zero, so instead of maximizing the variance you can
maximize the ln(variance), a proportion must remain between zero and
one, so instead of maximizing the proportion one can maximize the logit
of the proportion, a correlation must stay between -1 and 1 so instead
of maximizing the correlation one can maximize the Fisher Z transformed
correlation.

However, Nick just explained that you do not need to do that, and I
agree. Adding some constant to a variable so that the log doesn't
become zero is making an error, maybe or maybe not a necessary error
but still an error, why do you expect your data to be able to inform
you about an error?

Hope this helps,
Maarten

--- aslihan arslan <aslihanarslan@yahoo.com> wrote:

> Thanks for those who responded to my previous
> question. 
> I have an updated question about the non-linear ML
> programming and constraints: 
> 
> Is there way of introducing inequality constraints for
> the *parameters* defined by "args" at the beginning of
> an ml program? 
> 
> Thanks,
> aslihan arslan
> 
> --- n j cox <n.j.cox@durham.ac.uk> wrote:
> 
> > I don't think anyone needs to look at your code,
> > as at least one major problem is evident in
> > your footnote.
> > 
> > You say you are using a constraint like
> > 
> > constraint 1 `alpha'>0
> > 
> > Here I take your "like" literally. It so happens
> > that -constraint- doesn't complain if you specify
> > a constraint in this way -- even if you have not
> > specified a local macro called alpha -- but that
> > absence of bad news is not good news.
> > 
> > First, your constraint is an inequality and as such
> > not linear and thus outwith the reach of
> > -constraint-.
> > Perhaps -constraint- is a bad name and it really
> > should be
> > -linearconstraint- but that would get no votes in
> > the
> > Statavision Name Contest. No matter: it is plainly
> > laid out in the help that -constraint- deals with
> > linear
> > constraints (and none other).
> > 
> > Second, although your constraint won't do, it is
> > also
> > wrong for another reason. Constraints take their
> > identities
> > from variable names and possibly equations, and
> > -constraint-
> > can't work with names that happen to be your private
> > names
> > for parameters, even if those names are used inside
> > your
> > program. (You certainly can't expect -constraint- to
> > look
> > inside your program!)
> > 
> > So far, all negative.
> > 
> > I would forget about the constraint. If your
> > specification
> > is sensible a positive value for alpha will emerge
> > from the
> > estimation. If it doesn't you have a signal that the
> > apecification
> > is suspect in that regard.
> > 
> > Alternatively, just try log(x + 1). The extra degree
> > of freedom
> > might come in handy. I used to think log(x + 1) was
> > a fudge but
> > I now regard it more fondly. It's a function that
> > goes to 0 as x goes
> > to 0 from above and it behaves like log x as x gets
> > very large,
> > so it is fairly well motivated.
> > 
> > Nick
> > n.j.cox@durham.ac.uk
> > 
> > aslihan arslan
> > 
> > I am trying to program an ML model to estimate Log
> > Cobb Douglas production function where some rhs
> > variables have zero values. To make logs defined I
> > am
> > adding a constant to variables with zeros that needs
> > to be estimated too (hence nonlinear MLE).  The
> > function looks like:
> > 
> > lnY=B0+B1*lnX1+B2*ln (X2+alpha)+epsilon
> > 
> > where X2 is the variable with some zero values, and
> > B0, B1, B2 and alpha need to be estimated. I am also
> > using a constraint like:
> > constraint 1 `alpha'>0.
> > 
> > My program does not work and I am wondering whether
> > anybody can help me with this program. I did not
> > paste
> > the whole program here since it is a little long,
> > but
> > can send it to those who could help.
> > *
> > *   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/
> > 
> 
> 
> 
> 
>  
>
____________________________________________________________________________________
> Now that's room service!  Choose from over 150,000 hotels
> in 45,000 destinations on Yahoo! Travel to find your fit.
> http://farechase.yahoo.com/promo-generic-14795097
> *
> *   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/
> 


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

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

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


	
	
		
___________________________________________________________ 
New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes. 
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk 
*
*   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/



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