On Mon, 13 Aug 2012, Allin Cottrell wrote:
On Mon, 13 Aug 2012, Logan Kelly wrote:
> Is there a cumulative product command similar to the
> cumulative sum command cum?
Not built-in, but it's trivial to write.
<hansl>
function series cumprod (series y)
y = y * y(-1)
return y
end function
</hansl>
Beware the power of logarithms!
<hansl>
nulldata 10
fact = exp(cum(ln(index)))
print index fact -o
</hansl>
--------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
--------------------------------------------------