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
[email protected]
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/