Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

RE: st: Looping Enquiry

From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   RE: st: Looping Enquiry
Date   Thu, 29 Sep 2011 15:21:06 +0100

This is normally a good idea, but in this case the variable concerned is often negative, which to me implies that other methods have greater appeal. 

[email protected] 

Valerie Orozco

The first idea that comes in my mind is to transform the problem.
If you think in a sum rather than in a product it will be easier to program it.
Indeed,  since the logarithm of a product is the sum of the logarithms, you can use it to program you formula easier in Stata.

score	transform to log	generate a cumulative sum	transform to exponential to have what you want 
x1	lnx1	                                         lnx1	                                                  x1
x2	lnx2	                                         lnx1+lnx2	                                                     x1x2
x3	lnx3	                                                  lnx1+lnx2+lnx3	              x1x2x3

*   For searches and help try:

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