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

From |
n j cox <n.j.cox@durham.ac.uk> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Re: Is there a statacommand for a Historical Maximum? & Howtocumulate series? |

Date |
Mon, 26 Sep 2005 13:22:06 +0100 |

In addition an -egen- function -record()- is available in the

-egenmore- package on SSC.

Nick

n.j.cox@durham.ac.uk

Michael Blasnik

You can get the running/cumulative maximum using subscripting, such as

gen cummax=x in 1

replace cummax=max(x,cummax[_n-1]) in 2/l

If you have panel data or missing data/gaps, you may want to check out using time series operators by using tsset. You can get a cumulative sum using the sum function

gen cumsum=sum(x)

Bob Rijkers

Is there a command in stata that gives the historical maximum of a series? (Not the absolute maximum!; i.e. the historical maximum at time T is the maximum of the observations from time t=0 up until t=T. Similarly, the historical maximum at time t=T+1 is the maximum of all the observations from time t=0 up until t=T=1, and so on; the historical maximum thus changes over time, whereas the absolute maximum can only take one value.

My second question is more straightforward; is there a command to cumulate series in Stata (i.e. to calculate the sum of price increases over time)?

*

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

- Prev by Date:
**RE: st: Multicollinearity in a simple Poisson model** - Next by Date:
**Re: st: RE: Is there a statacommand for a Historical Maximum? & Howto cumulate series?** - Previous by thread:
**st: Is there a statacommand for a Historical Maximum? & How to cumulate series?** - Next by thread:
**Re: st: RE: Is there a statacommand for a Historical Maximum? & Howto cumulate series?** - Index(es):

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