s-news
[Top] [All Lists]

Re: Time Series Observation Identification

To: s-news@lists.biostat.wustl.edu
Subject: Re: Time Series Observation Identification
From: Jody McIntyre <jody_mcintyre99@yahoo.com>
Date: Wed, 23 Nov 2005 03:26:27 -0800 (PST)
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=Z8dftm3wl98RCBe9m4mRSG3WRG2qcd1oS8nKdwxfrWqskAL7vH4eJlmOoM4M8jkdgxQqk6eG5MsLxGqezkd4SYYuQuKRISosm+wmz3ye26ohkGxsm9fqWnenZ31fNnNpNlKbOUDvRuHd6ONgKijkmAuXPFo3qB/LbOmRNTUH6Sc= ;
Dear S-News,
 
I have a very large time series dataset with several variables, for example:
 
Y1           x1            x2 ??????????.
.
Yn            x1n        x2n
 
where x1 ?..xn  can be row number, year, month day etc.
 
I would like to write a routine (or perhaps 2 if necessary) in S-Plus (Windows Version 6.1) to identify the nth highest (lowest) maximum (minimum) y for a given time period, say year. If there are any missing values (i.e. less than 'n' non-missing values), the routine would need to be aware of this and function accordingly.
 
Having identified the above, I would then like to calculate the 5 year moving average. For example, if in the above routine I were to identify the 12th highest value y for every year 1-23, I would then like to calculate a moving average of span 5 [(yt, yt-1, yt-2, yt-3, yt-4))/ 5]. Clearly, some averages would not be able to be calculated (i.e. t<5) because there would not be enough observations available.
 
I have been told that it would be possible to carry out such manoeuvres in STATA using the syntax _n and _N and the 'sort' command but I wish to use S-Plus for its other time series capabilities.
 
Any insights gratefully acknowledged. I will publish any responses received.
 
Jody


Yahoo! FareChase - Search multiple travel sites in one click.
<Prev in Thread] Current Thread [Next in Thread>
  • Re: Time Series Observation Identification, Jody McIntyre <=