Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

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

From |
Nick Cox <njcoxstata@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Re: Finding Maximum of a series |

Date |
Sat, 19 Nov 2011 15:11:24 +0000 |

Reverse time first for the latest question. On Sat, Nov 19, 2011 at 3:09 PM, Nick Cox <njcoxstata@gmail.com> wrote: > max(inv, roll_max[_n-1]) > > On Sat, Nov 19, 2011 at 3:09 PM, Nick Cox <njcoxstata@gmail.com> wrote: >> It is unnecessary to fire up heavy plant here. Assuming time order the >> maximum so far, a.k.a. a record, is just >> >> gen roll_max = inv[1] >> replace roll_max = max(inv, roll_max[_n-1] in 2/L >> >> and even for panels you just need to do that under the aegis of -by:-. >> >> There is an -egen- function -record()- in -egenmore- from SSC. >> >> Nick >> >> On Sat, Nov 19, 2011 at 2:56 PM, Tirthankar Chakravarty >> <tirthankar.chakravarty@gmail.com> wrote: >>> Use the "rrecursive" option rather than the "recursive" option: >>> >>> ********************************************** >>> webuse lutkepohl2, clear >>> tsset qtr >>> rolling roll_max=r(max), window(1) /// >>> rrecursive: su inv >>> ********************************************** >>> >>> T >>> >>> On Sat, Nov 19, 2011 at 6:39 AM, ajjee <ajjee1@yahoo.com> wrote: >>>> Thanks! >>>> >>>> -rolling- worked. But If I am interested in >>>> >>>> Maximum wage in 1940 to 2000 >>>> Maximum wage in 1941 to 2000 >>>> Maximum wage in 1942 to 2000 >>>> Maximum wage in 1943 to 2000 >>>> >>>> and so on till >>>> >>>> Maximum wage in 1999 to 2000 >>>> >>>> How can i use -rolling- to compute this. >>>> >>>> Thanks in advance. >>>> >>>> ajjee >>>> >>>> >>>> >>>> >>>> From: Tirthankar Chakravarty <tirthankar.chakravarty@gmail.com> >>>> Date: 19 November 2011 19:05 >>>> Subject: Re: st: Finding Maximum of a series >>>> To: statalist@hsphsun2.harvard.edu >>>> >>>> >>>> Your most robust option is to use -rolling-. For example, >>>> >>>> ********************************************** >>>> webuse lutkepohl2, clear >>>> tsset qtr >>>> rolling roll_max=r(max), window(1) /// >>>> recursive: su inv >>>> ********************************************** >>>> >>>> T >>>> >>>> On Sat, Nov 19, 2011 at 5:54 AM, Muhammad Anees <anees@aneconomist.com> >>>> wrote: >>>>> If you have to find the maximum in a series say (x), use >>>>> >>>>> sort x >>>>> list x in 1 >>>>> >>>>> On Sat, Nov 19, 2011 at 6:40 PM, ajjee <ajjee1@yahoo.com> wrote: >>>>>> Dear All >>>>>> >>>>>> I have a time series dataset ranging from 1940 to 2000. I have to find >>>>>> the >>>>>> maximum value in series(wage) in the following way: >>>>>> >>>>>> Maximum wage in 1940 to 1941 >>>>>> Maximum wage in 1940 to 1942 >>>>>> Maximum wage in 1940 to 1943 >>>>>> Maximum wage in 1940 to 1944 >>>>>> >>>>>> and so on till >>>>>> >>>>>> Maximum wage in 1940 to 2000 >>>>>> >>>>>> How can I compute this value. >>>>>> Thanks in advance >>>>>> >> > * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: Finding Maximum of a series***From:*ajjee <ajjee1@yahoo.com>

**st: Re: Finding Maximum of a series***From:*ajjee <ajjee1@yahoo.com>

**Re: st: Re: Finding Maximum of a series***From:*Tirthankar Chakravarty <tirthankar.chakravarty@gmail.com>

**Re: st: Re: Finding Maximum of a series***From:*Nick Cox <njcoxstata@gmail.com>

**Re: st: Re: Finding Maximum of a series***From:*Nick Cox <njcoxstata@gmail.com>

- Prev by Date:
**Re: Re: st: RE: dfuller: why do I get different results?** - Next by Date:
**Re: Re: st: RE: dfuller: why do I get different results?** - Previous by thread:
**Re: st: Re: Finding Maximum of a series** - Next by thread:
**re:st: Finding Maximum of a series** - Index(es):