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]

Re: st: conditions based on stored results after model estimation in forvalues loop


From   Abdul Adam <[email protected]>
To   [email protected]
Subject   Re: st: conditions based on stored results after model estimation in forvalues loop
Date   Thu, 21 Nov 2013 11:59:04 +0100

Dear Maarten
Yes! All of them worked for me. You have put a smile on my face:-)
Thank you very much.
Abdul.

On Thu, Nov 21, 2013 at 11:45 AM, Maarten Buis <[email protected]> wrote:
> What about:
>
> forvalues i = 1/5{
>     forvalues j = `i' /5 {
>         ...
>     }
> }
>
>
> or if g11, g22, etc. do not exist:
>
> forvalues i = 1/5{
>     local begin = `i' + 1
>     forvalues j = `begin' /5 {
>         ...
>     }
> }
>
> or the shorter version of that:
>
> forvalues i = 1/5{
>     forvalues j = `=`i'+1' /5 {
>         ...
>     }
> }
>
> Hope this helps,
> Maarten
>
> On Thu, Nov 21, 2013 at 11:37 AM, Abdul Adam <[email protected]> wrote:
>> Dear Stata Community
>> I have run a model and the plan was to use the stored coefficients in
>> a forvalues loop like this:
>>
>> forvalues i=1/5 {
>> forvalues j=1/5 {
>> nlcom e`i'`j': capphi`i'_mean*(((_b[/g`i'`j'])-
>> (_b[/b`i']*w`j'_mean))/(w`i'_mean*(1-(_b[/lag`i']))))
>> }
>> }
>>
>> The problem I am facing is because of symmetry restrictions, g`i'`j' =
>> g`j'`i', since these should be equal only  g`i'`j' are included in the
>> model, and hence in the stored coefficient matrix. for instance there
>> is g12 in the stored results, but not g21. When I run the loop, it is
>> OK, until it reaches g21, after which it stops and shows:
>>
>> equation g21 not found
>> r(111);
>>
>>
>> This is because there is no g21 included in the model, BUT since
>> g21=g12, that is not a problem. The problem is: I could not find a way
>> to tell Stata, that when it sees _b[/g21] it should instead use
>> _b[/g12].
>>
>> Therefore, I would appreciate if anyone could help me figure out how
>> to convince Stata that when it sees _b[/g`j'`i'] AND it cannot find
>> this coefficient, then it should replace it with _b[/g`i'`j'].
>>
>> Kind Regards
>> Abdul Adam
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/faqs/resources/statalist-faq/
>> *   http://www.ats.ucla.edu/stat/stata/
>
>
>
> --
> ---------------------------------
> Maarten L. Buis
> WZB
> Reichpietschufer 50
> 10785 Berlin
> Germany
>
> http://www.maartenbuis.nl
> ---------------------------------
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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