s-news
[Top] [All Lists]

Time Series: How to build irregular sequences without tears

To: <s-news@lists.biostat.wustl.edu>
Subject: Time Series: How to build irregular sequences without tears
From: "Paul H. Lasky" <phlasky@earthlink.net>
Date: Mon, 23 Jun 2003 07:45:18 -0700
There is no "c" or concetration function for timeDate objects. And the append function cannot be used to splice together two timeDate sequences. How then do you build irregular time series, e.g. how do you build a daily sequence that avoids the 9/11/01 shutdown dates at the NYSE and other exchanges?
 
    I discovered an easy way that works for version 6.0 or 6.1 on any Windows 98 or later system. To splice together two timeDate objects say td1 and td2 use the following function:
 
      # ----------------Concetrate TimeDates------------
      #  This function allows the creation of irregular timeDate
      # sequences without tears.
      c. time <- function(td.one,td.two)
       {
         tda <- append(td.one, td.two)
         dates(append(tda[[ 1]] [[ 1]], tda[[ 6 ]] [[ 1 ]]
       }
 
     Thus to create a timedate sequence of only the trading days for 2001 you cannot simply use the holiday.NYSE and bizdays functions because they do not include the abrupt shutdown of the trading caused by the catastrophe. Here's how you do it:
 
      td.one <- timeSeq(from = "1/2/01", to = "9/10/01", by = "bizdays", holidays = holiday.NYSE(2001) )
 
     td.two <- timeSeq(from = "9/17/01", to = "12/31/01", by = "bizdays", holidays = holiday.NYSE(2001) )
 
td <- c.time(td.one, td.two)
 
    Paul H. Lasky
    P & B Consultants
<Prev in Thread] Current Thread [Next in Thread>