Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: combinations of parameters estimated


From   "Maarten Buis" <M.Buis@fsw.vu.nl>
To   Valérie Orozco <Valerie.Orozco@toulouse.inra.fr>
Subject   st: RE: combinations of parameters estimated
Date   Mon, 10 Jul 2006 10:57:30 +0200

Valérie:

You could build the command in loops and store it as a sting in a local macro, and in the end call that string to run the entire command. Below is a command I think will work, but I cannot check it. The first loop creates a local macro called nlcom`i'`j', where i and j are replaced with the appropriate numbers depending on the state of the loop. Stata normally sees a hard return as a sign that the command has ended. In my previous post I told Stata to ignore the hard returns within the command by commenting them out (put the hard returns between /* and */). This won't work here since I told Stata that that line is a string, which is not to be interpreted (yet). So instead I changed the "end of command sign" to ; with the command #delim ; after that I changed it back to hard return with the command #delim cr. The second loops pasts the different commands together. Note both local commands do not contain a = sign. This helps to keep the length of the string below the maximum le
 ngth, however the maximum string length may still bite. 

HTH,
Maarten  

Ps. Since this is a problem that is likely to be encountered by other users of the Statalist I have forwarded it to the statalist as well, so people can find it if they are looking for this in the statalist archive.

forvalues  i = 1 / $NEQN  {
   forvalues j = 1 / `--i'  { 
       #delimit ;
        local nlcom`i'`j'  
          "(e`i'`j'bis : _b[gamma:g`i'`j'] /a`i'  - _b[beta:b`i']  * (a`j'/a`i') )
           (e`j'`i'bis : _b[gamma:g`i'`j'] /a`j'  - _b[beta:b`j']  * (a`i'/a`j') ) 
           (eh`i'`j'bis : _b[gamma:g`i'`j'] /a`i' - _b[beta:b`i']  * (a`j'/a`i')  + a`j' * ((_b[beta:b`i']/a`i') + 1 )) 
           (eh`j'`i'bis : _b[gamma:g`i'`j'] /a`j'  - _b[beta:b`j']  * (a`i'/a`j')  + a`i' * ((_b[beta:b`j']/a`j') + 1 ))" ;
       #delimit cr
    }
}

forvalues  i = 1 / $NEQN  {
   forvalues j = 1 / `--i'  { 
        local nlcom "`nlcom' `nlcom`i'`j''"  
    }
}
#delimit ;
nlcom `nlcom' ;
#delimit cr

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology 
Vrije Universiteit Amsterdam 
Boelelaan 1081 
1081 HV Amsterdam 
The Netherlands

visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z214 

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

-----Original Message-----
From: Valérie Orozco [mailto:Valerie.Orozco@toulouse.inra.fr]
Sent: maandag 10 juli 2006 9:50
To: Maarten Buis
Subject: combinations of parameters estimated

Thank you very much Maarten,
I haven't  thought of the post command of nlcom.
Concerning the variance covariance matrix, I can have it if and only if
I construct all the combinations I want in a unique declaration of
nlcom. It is logical but I don't know if it will be easy for my problem
since I have many elasticities to estimate and since I wanted te
generate them automatically (with loops) like :

forvalues  i = 1 / $NEQN  {
    local iminus = `i' - 1
    forvalues j = 1 / `iminus'  { 
        nlcom (e`i'`j'bis : _b[gamma:g`i'`j'] /a`i'  - _b[beta:b`i']  *
(a`j'/a`i') )   /*
       */  (e`j'`i'bis : _b[gamma:g`i'`j'] /a`j'  - _b[beta:b`j']  *
(a`i'/a`j') ) /*
        */  (eh`i'`j'bis : _b[gamma:g`i'`j'] /a`i'  - _b[beta:b`i']  *
(a`j'/a`i')  + a`j' * ((_b[beta:b`i']/a`i') + 1 ))  /*
       */ (eh`j'`i'bis : _b[gamma:g`i'`j'] /a`j'  - _b[beta:b`j']  *
(a`i'/a`j')  + a`i' * ((_b[beta:b`j']/a`j') + 1 ))
    }
}

Do you have another idea or Have I to choose whether to compute
automatically without variance covariance matrix (of all the
elasticities I want), whether to write all the elasticities I want in
one nlcom command, but depending on the case...

--

***********************
Valérie Orozco
INRA ESR Toulouse - FRANCE
ESR INRA - BP52627 - 31326 Castanet Tolosan Cedex
orozco@toulouse.inra.fr
05-61-28-50-97
***********************




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



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index