[R-sig-finance] How and when to USE ts and its objects?

Ajay Shah ajayshah at mayin.org
Mon Oct 4 18:06:04 CEST 2004


> ts is for regularly spaced time series and works best with
> monthly or coarser time series since there is no explicit
> date support for finer granularity in ts.  If such date
> support is not important then ts is fine for finer
> granularity series as well.  ts is defined in the stats
> package which comes out-of-the-box with R so its normally
> always available and is therefore the most likely to be
> supported.

Yes. I only use ts for monthly or slower data.

> If you need irregularly spaced time series such as those
> that are defined for weekdays but not holidays or weekends then
> you can choose from a number of options:
> 
> 1. The irts class in the tseries package changes the
> frequency of the time scale to simulate a irregular time
> series with a regular one in such a way that its reversable.
> 
> 2. The its class in the its package uses S4 constructs to
> define a time series object with a POSIXct time scale.

ITS is not being actively developed right now. It seems to have
fabulous functionality but it would be great if it was not orphaned.

> 3. The zoo class has _not_ hard coded in the datetime class
> so it can use just about any datetime class (e.g. Date,
> chron, POSIXct).  In most cases zoo implements methods which
> simply extend base generics to achieve interface
> compatibility with ts and the base.  This also means that in
> most cases the user does not have to learn a whole new set
> of commands making it easier to use. A major new version of
> zoo is in development so it is being actively maintained and
> enhanced.  The current version of zoo on CRAN will import ts
> and irts objects (as well as matrices and vectors) and the
> upcoming version will also import its objects.  Its also
> easy to extract the data and datetime.   
> 
> I personally use ts for my regular time series and zoo for
> my irregular time series and have contributed to the
> development of the latter.

Gabor, I'm sure you know full well the full power of ITS. Is zoo
headed to match that, and then to do better? I, for one, will be happy
to pitch in and help by using zoo, contributing suggestions and
perhaps occasionally a little code, bug reports, etc.

If ITS is 'the existing standard' then wouldn't it be nice if zoo
would import and export ITS objects, so as to ease interoperability?

Curious: I was struck by the coolness of union() and intersect() in
ITS. Does zoo do these already?

-- 
Ajay Shah                                                   Consultant
ajayshah at mayin.org                      Department of Economic Affairs
http://www.mayin.org/ajayshah           Ministry of Finance, New Delhi



More information about the R-sig-finance mailing list