[R-SIG-Finance] Solicitation of opinions on which Timeseries object(s) to utilize.
Gabor Grothendieck
ggrothendieck at gmail.com
Mon Jan 21 21:13:43 CET 2008
On Jan 21, 2008 1:35 PM, Andrew Piskorski <atp at piskorski.com> wrote:
> On Sun, Jan 20, 2008 at 09:55:40AM -0600, Joe W. Byers wrote:
> > I am soliciting your opinions on the different time series objects as to
> > which you prefer, or which you do not prefer. I have been using
>
> I don't know anything about which R time series packages are better
> (or for what), but I do have a list of some of the ones that exist:
>
> zoo: http://cran.r-project.org/src/contrib/Descriptions/zoo.html
> dse: http://www.bank-banque-canada.ca/pgilbert/
> its: http://cran.r-project.org/src/contrib/Descriptions/its.html
> urca: http://cran.r-project.org/src/contrib/Descriptions/urca.html
> ast: http://sirio.stat.unipd.it/index.php?id=libast
> tseries: http://cran.r-project.org/src/contrib/Descriptions/tseries.html
> tsa2: http://www.stat.pitt.edu/stoffer/tsa2/index.html
> http://www.amazon.com/Time-Analysis-Its-Applications-Statistics/dp/0387293175/
> RTisean, tsdyn, and tserieschaos:
> http://antonio.fabio.googlepages.com/rprojects
> And even more via 'label:timeseries' on Google Code:
> http://code.google.com/hosting/search?q=label:timeseries&filter=0
I think many of these are focused on time series functions rather than
time series representations which seems to be more the topic of
discussion.
The CRAN Task Views on empirical finance and econometrics have some
discussion and lists of the time series packages in R.
>
> And here's my super-short summary of what others have said elsewhere
> in this thread:
>
> - zoo and/or xts are good.
Maybe that is going a bit far in cursory treatment.
xts
- what xts is is a subclass of zoo with its own is, as, coredata, print
and [ methods.
- it requires use of Date or POSIXct as the index class. This has
the advantage that it can make certain assumptions which its
superclass zoo cannot make due to zoo's greater generality.
For example, the :: notation (which is roughly a counterpart of the
window() function in ts and zoo) is made possible by the fact that
it knows that the index is Date or POSIXct whereas zoo's
index could be practically anything. On the other hand, with
xts you cannot directly model a quarterly series, say, other
than to embed it into a daily series, say. However, as xts
is a zoo subclass you can directly access all zoo functionality
whenever you want so it would not be a problem to use xts
to model a daily Date class series and then convert it to yearmon
and keep going using just zoo at that point.
- xts has an as.xts.timeSeries method which can convert
timeSeries objects to xts/zoo.
- xts is at version 0.0.x and is not ready for wide use (all
the examples posted here would not work when I tried them)
but over time xts may gain maturity. Given the interest shown
I would expect it might proceed rapidly.
zoo is a mature package with two vignettes (three in the next
version) that has been around quite a while now and provides
a general framework for modelling irregularly spaces series.
A description of zoo can be found in
library(zoo)
vignette("zoo")
vignette("zoo-quickref")
There are many other packages that use it or add
infrastructure to it such as xts, quantmod, dyn,
strucchange, etc.
> - zoo and/or xts basically make ts and tseries obsolete.
I don't think they make ts obsolete. zoo (and therefore xts)
models irregularly spaced series and zoo also has a model for
irregularly spaced series which having an underlying regularity
whereas ts is based on strictly regular series. Of course both
of zoo's irregular ones include regular ones as a subset but there
may be some situations where you prefer to model the regularity
directly. Also ts is in the core of R and zoo and xts are not.
I use ts sometimes although I use zoo more.
tseries contains a time series model, irts. The rest of tseries
consists of various time series functions and do not depend on irts
thus tseries as a package is not obsolete.
> - Rmetrics' timeSeries is useful but has certain problems.
Its main advantages are that many or at least some Rmetrics
functions use or can use that representation and it supports
financial centers.
Financial centers is really a property of the index class and not
necessarily of the time series so one could support this in zoo as
well by defining an appropriate index class. e.g. as.xts.timeSeries
More information about the R-SIG-Finance
mailing list