Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: RE: Initial values in -nl-


From   "Brian P. Poi" <[email protected]>
To   <[email protected]>
Subject   st: RE: Initial values in -nl-
Date   Sat, 13 Nov 2010 13:39:16 -0500

On Friday, November 12, 2010 12:49 PM Herve STOLOWY wrote:

Dear Statalisters:

Last week, I asked a question relating to inequality constraints in a regression. I received several interesting answers, including the following one from Isabel (Stata Corp), who suggested to use -nl- for the constraint: a1 < a2:

nl  (y = {a1}*x1 +({a1} + exp({c}))*x2 + {a3}), initial (a1 1 c 1   a3
0)

...


Now, I introduce the constraint a2< a4 by replacing a4 by ({a2}+ exp{c}) (as in the example provided by Isabel):

nl (VTA = {a1}*g_t + {a2}*g_ca + {a3}*g_i + ({a2}+ exp{c})*g_ca_t + {a5}*g_ca_i + {a6}*g_t_i + {a7}*g_ca_t_i), initial(a1 1 a2 1 a3 1 c 1 a5
1 a6 1 a7 1)

I get an error message concerning the initial values (I guess):

error #111 occurred in evaluating expression
exp__000002 not found
starting values invalid or some RHS variables have missing values

--------------

Herve,

The only problem here is that you are missing the parentheses associated with the exp() function.  Instead of

   ({a2}+ exp{c})*g_ca_t

that term should be

   ({a2}+ exp({c}))*g_ca_t

The first thing -nl- does is substitute parameters like {c} with the name of a temporary matrix and a subscript.  That’s why -nl- doesn't understand what "exp__000002" means.


   -- Brian Poi
   -- [email protected]




*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index