Valérie,
maybe you could subdivide the calculation of coefficients with very
long expressions by calling -nlcom, post- multiple times, carrying
through the subcalculations. The second -nlcom- will calculate on the
basis of the estimation results from the first call to -nlcom-...
Something like this (although you have to be careful how you subdivide
or the variance estimates will not be valid):
*----------------------------------------------------------*
// exp(V_i) and CV estimates
*----------------------------------------------------------*
#delim ;
nlcom
(price: _b[egenbet])
(epen0: exp((_b[pen50] + _b[egenbet]*125 + _b[pen])))
(epen1: exp((_b[pen50] + _b[egenbet]*125 +
_b[intmaal] + _b[pen])))
(einh0: exp(((_b[inh600]/5) + _b[egenbet]*800 +
_b[dagXinh] + _b[hoste] + _b[inh])))
(einh1: exp((_b[dagXinh] + _b[egenbet]*800 +
_b[hoste] + _b[inh])))
(epen0a: exp((_b[pen50] + _b[egenbet]*125 + _b[pen])))
(epen1a: exp((_b[pen50] + _b[egenbet]*125 +
_b[intmaal] + _b[pen])))
(einh0a: exp(((_b[inh600]/5) + _b[egenbet]*125 +
_b[dagXinh] + _b[hoste] + _b[inh])))
(einh1a: exp((_b[dagXinh] + _b[egenbet]*125 +
_b[hoste] + _b[inh])))
, post;
// CV estimates for section 5.8;
nlcom
(epen0: _b[epen0])
(epen1: _b[epen1])
(einh0: _b[einh0])
(einh1: _b[einh1])
(CV_pen: (-1/_b[price]) *
(ln(_b[epen0] + _b[einh0]) -
ln(_b[epen1] + _b[einh0]))
)
(CV_inh: (-1/_b[price]) *
(ln(_b[epen0] + _b[einh0]) -
ln(_b[epen0] + _b[einh1]))
)
, post;
estimates store CV01;
#delim cr
-- Jesper K. Hansen
On Thu, Feb 21, 2008 at 2:41 PM, Valerie Orozco
<[email protected]> wrote:
> 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/