Hi all,
In case other people might face the problem I mentioned yesterday in the future : Brian Poi of Statacorp has been very helpful in providing me with a way of avoiding the "expression too long" error.
Apparently, the limit I had reached with the expression I fed Stata is that of the replace/generate commands, which underlie the nl command when it is used with a substitutable expression (which was the case with my method).
Brian Poi therefore tried (successfully) to estimate the same model with the function evaluator program version of the nl command. Instead of having the "nl" command evaluate the function in the RHS, potentially facing length limitations, it is evaluated through the user-specified function evaluator program. This method allows the user to feed nl with any function, regardless of, say, the number of operators needed to evaluate it.
Best
Timothée Carayol
PhD in Economics
London School of Economics
-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Carayol,TM (pgt)
Sent: 01 August 2006 16:58
To: statalist@hsphsun2.harvard.edu
Subject: st: "Expression too long" error with nl command
Dear all,
I am trying to estimate a non-linear model of the form
Depvar = linear combination of 300 fixed effect dummy variables + alpha
* (log(linear combination of 10 variables)) + beta * (log(linear
combination of 10 other variables))
Stata doesn't like that and tells me
"error #130 occurred in evaluating expression
expression too long"
The matter is not the length of the command I feed Stata as measured in
terms of characters or lines : it is actually only a few lines long (see
below). Apparently it is the number of parameters to estimate, or of
variables, that causes the problem.
Does anybody know of a way I could estimate this nonetheless with Stata?
If I could just get the fixed effects out of the model specification,
but still have Stata take them into account, I would be happy as well,
but it seems like there is no such option for nl (as opposed to xtreg's
fe option).
I checked in the Statalist archives, but apparently last time someone
asked this the question remained pretty much open.
(Below is the model I try to feed Stata)
#delimit ;
nl (lmv=
{mu1} + {ttw: ttw*}
+ {alpha}*(log(
u1+{t1:u0 u2 u3 u4 u5 u6 u7 u8 u9}
))
+ {beta}*(log(
v1+{z1:v2 v3 v4 v5 v6 v7 v8 v9}
))),
initial(
t1_u0 .1 t1_u2 .1 t1_u3 .1 t1_u4 .1 t1_u5 .1 t1_u6 .1 t1_u7 .1 t1_u8 .1
t1_u9 .1
z1_v2 .1 z1_v3 .1 z1_v4 .1 z1_v5 .1 z1_v6 .1 z1_v7 .1 z1_v8 .1 z1_v9 .1
);
#delimit cr
*
* 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/
*
* 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/