# st: st : Problem with nlcom (expression too long)

 From Valerie Orozco <[email protected]> To "[email protected]" <[email protected]> Subject st: st : Problem with nlcom (expression too long) Date Thu, 21 Feb 2008 14:41:39 +0100

```Hello,

Since I didn't receive any answer to the problem I have, I am going to try to better explain what is going on...maybe I wasn't clear enough...
I have a problem with “nlcom” due to a problem of length.

I try to estimate a lot of coefficients from a first estimation. My program consists in writing all the coefficients I want in some macros (local) and run the nlcom command with only one big macro.
The problem of length comes from the fact that some coefficients I have to estimate are also combinations of coefficients I estimate in the same “nlcom” command.

For example, some coefficients I have to estimate after my estimation are:

local a14 "(a14:  1 - ( _b[a1]+  _b[a2]+  _b[a3]+  _b[a4]+  _b[a5]+  _b[a6]+  _b[a7]+  _b[a8]+  _b[a9]+  _b[a10]+  _b[a11]+  _b[a12]+  _b[a13]))"
local nlcom  "`nlcom'  `a14'"

local "(b14:  - ( _b[b1]+  _b[b2]+  _b[b3]+  _b[b4]+  _b[b5]+  _b[b6]+  _b[b7]+  _b[b8]+  _b[b9]+  _b[b10]+  _b[b11]+  _b[b12]+  _b[b13]))"
local nlcom  "`nlcom'  `b14'"

local g1vs1 "(g1vs1:  _b[teta_1vs1] - _b[a1] * _b[a1] + _b[a1])"
local nlcom  "`nlcom'  `g1vs1'"
local g1vs2 "(g1vs2:  _b[teta_1vs2] - _b[a1]* _b[a2])"
local nlcom  "`nlcom'  `g1vs2'"
local g1vs3 "(g1vs3:  _b[teta_1vs3] - _b[a1]* _b[a3])"
local nlcom  "`nlcom'  `g1vs3'"
local g1vs4 "(g1vs4:  _b[teta_1vs4] - _b[a1]* _b[a4])"
local nlcom  "`nlcom'  `g1vs4'"
local g1vs5 "(g1vs5:  _b[teta_1vs5] - _b[a1]* _b[a5])"
local nlcom  "`nlcom'  `g1vs5'"
…
local g1vs14 "(g1vs14:  -( _b[teta_1vs1] - _b[a1] * _b[a1] + _b[a1] +  _b[teta_1vs2] - _b[a1] * _b[a2] +  _b[teta_1vs3] - _b[a1] * _b[a3] +  _b[teta_1vs4] - _b[a1] * _b[a4] +  _b[teta_1vs5] - _b[a1] * _b[a5] +  _b[teta_1vs6] - _b[a1] * _b[a6] +  _b[teta_1vs7] - _b[a1] * _b[a7] +  _b [teta_1vs8] - _b[a1] * _b[a8] +  _b[teta_1vs9] - _b[a1] * _b[a9] +  _b[teta_1vs10] - _b[a1] * _b[a10] +  _b[teta_1vs11] - _b[a1] * _b[a1 1] +  _b[teta_1vs12] - _b[a1] * _b[a12] +  _b[teta_1vs13] - _b[a1] * _b[a13] +   0))

/*In fact g1vs14 is equal to:  -( g1vs1 +  g1vs2 +  g1vs3+  g1vs4 +  g1vs5 +  …. +g1vs13) but I can't write this since the g1vs1, g1vs2...aren't estimated yet, they are in some locals*/
local nlcom  "`nlcom'  `g1vs14'"

local g2vs14 "(g2vs14:  -( _b[teta_1vs2] - _b[a2] * _b[a1] +  _b[teta_2vs2] - _b[a2] * _b[a2] + _b[a2] +  _b[teta_2vs3] - _b[a2] * _b[a3] +  _b[teta_2vs4] - _b[a2] * _b[a4] +  _b[teta_2vs5] - _b[a2] * _b[a5] +  _b[teta_2vs6] - _b[a2] * _b[a6] +  _b[teta_2vs7] - _b[a2] * _b[a7] +  _b[teta_2vs8] - _b[a2] * _b[a8] +  _b[teta_2vs9] - _b[a2] * _b[a9] +  _b[teta_2vs10] - _b[a2] * _b[a10] +  _b[teta_2vs11] - _b[a2] * _b[a11] +  _b[teta_2vs12] - _b[a2] * _b[a12] +  _b[teta_2vs13] - _b[a2] * _b[a13] +   0))"
local nlcom  "`nlcom'  `g1vs14'"
….
After that, I run : nlcom `nlcom', post

The problem is that for some coefficient I want (g`i'vs14 with i from 1 to 14, especially the g14vs14) the expression is quite long because I use the expression of the g`i' `j' with i and j <14. So Stata stops tells me :expression too long r(130);

How can I have all my coefficients in one matrix e(b) and e(V) doing several nlcom? (in order to have smaller expression using the coefficients obtained in a first nlcom...)
If someone has an idea…

Thank you very much.

Valérie

-------------------------------
Valérie OROZCO
Toulouse School of Economics (INRA-GREMAQ)
21, allée de Brienne
F-31000 Toulouse, France

MF 426
+33 5 61 12 85 91
-------------------------------

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