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

From |
"Scott Merryman" <smerryman@kc.rr.com> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: Is there a statacommand for a Historical Maximum? & How to cumulate series? |

Date |
Mon, 26 Sep 2005 07:08:11 -0500 |

Yes. 1. -egen- 2. -gen- For example: sysuse gnp96.dta,clear count gen max = . qui { forv i = 1/`=r(N)' { egen temp = max(gnp) in 1/`i' replace max = temp in `i' drop temp } } gen cumul_gnp = sum(gnp) Hope this helps, Scott > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu [mailto:owner- > statalist@hsphsun2.harvard.edu] On Behalf Of Bob Rijkers > Sent: Monday, September 26, 2005 5:32 AM > To: statalist@hsphsun2.harvard.edu > Cc: mattia.romani@shell.com > Subject: st: Is there a statacommand for a Historical Maximum? & How to > cumulate series? > > To Whom It May Concern, > > 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)? > > Sincerely, > > Bob Rijkers > > > P.S. I am trying to write a do-file to run the Gately price-decomposition > in Stata. This decomposition decomposes a price-series into a) an initial > condition, P1, b) the cumulative series of price decreases, Pdecr, c) the > cumulative series of price-increases that have led to an increase in the > historical maximum, Pmax d) the cumulative series of price-increases that > do not lead to an increase in the historical maximum, Pincr: > > Pt=P1+Pdecr+Pincr+Pmax > * > * 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/ * * 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/

**References**:**st: Is there a statacommand for a Historical Maximum? & How to cumulate series?***From:*Bob Rijkers <bob.rijkers@pembroke.oxford.ac.uk>

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

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