Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Running Product Function


From   Yuval Arbel <yuval.arbel@gmail.com>
To   statalist <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Running Product Function
Date   Sun, 9 Dec 2012 23:19:45 +0200

Dear statalisters,

Please ignore my previous e-mails regarding this question

After a short additional search, I found a very nice (and well known)
trick proposed by Nick Cox to address the problem (which, from some
reason did not come to my mind):

bysort group : gen prod = sum(ln(x))
by group : replace prod = exp(prod[_N])

On Sun, Dec 9, 2012 at 11:05 PM, Yuval Arbel <yuval.arbel@gmail.com> wrote:
> P.S. According to stata's help, the details of the author of the
> -prod()- function is:
>
> Philip Ryan
> Department of Public Health
> University of Adelaide
> South Australia
> pryan@medicine.adelaide.edu.au
>
>
> On Sun, Dec 9, 2012 at 10:53 PM, Yuval Arbel <yuval.arbel@gmail.com> wrote:
>> Dear Statalisters,
>>
>> I appreciate very much your assistance in the following question:,
>>
>> I'm looking for an equivalent function for -gen y1=sum()- which will
>> calculate running product for each point in time
>>
>> In fact, what I would like to calculate is a running geometric mean
>>
>> Note also that -gen y2=prod()- does not work (i.e., stata does not
>> identify the function). Only -egen y2=prod()- works, but it generates
>> only one product for each panel, and this is not what I need.
>>
>> Finally, I tried the -amean- command,, but it simply gives summary
>> statistics of different means, and it is not a function..
>> --
>> Dr. Yuval Arbel
>> School of Business
>> Carmel Academic Center
>> 4 Shaar Palmer Street,
>> Haifa 33031, Israel
>> e-mail1: yuval.arbel@carmel.ac.il
>> e-mail2: yuval.arbel@gmail.com
>> *
>> *   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/
>
>
>
> --
> Dr. Yuval Arbel
> School of Business
> Carmel Academic Center
> 4 Shaar Palmer Street,
> Haifa 33031, Israel
> e-mail1: yuval.arbel@carmel.ac.il
> e-mail2: yuval.arbel@gmail.com



-- 
Dr. Yuval Arbel
School of Business
Carmel Academic Center
4 Shaar Palmer Street,
Haifa 33031, Israel
e-mail1: yuval.arbel@carmel.ac.il
e-mail2: yuval.arbel@gmail.com
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index