[R] readcsvIts() to create irregular time series
Heywood, Giles
Giles.Heywood at CommerzbankIB.com
Tue Sep 2 13:21:54 CEST 2003
> BUT;
> 1. What can you do with informat and outformat? Is it the same as
> its.format() before the its function?
its.format() sets the text representation format for the times, and
once set, it persists within that R session. It is often convenient
to set this format just once in a session, since in many circumstances
multiple date formats serve only to distract and confuse. The arguments
informat and outformat in readcsvIts override the value set in
its.format().
>
> 2. Can the its be plotted onto a ts? And is a correlation analysis in
> between the two objects possible?
>
All regular time-series can be represented as irregular time-series -
they are a special case. If you want to use both, I suggest you convert
your regular time-series to irregular. You might for example use
seq.POSIXt(start,end,by="month") to set up a monthly series of POSIX
dates, and its(matrix,seq.POSIXt(start,end,by="month")) will then provide
you with a reglar time-series reprented as an 'its'.
Having done this, you can plot multiple series, which may not have the
same time-stamps, using for example:
xy <- unionIts(Fire,its(matrix,seq.POSIXt(start,end,by="month"))
plot(xy)
> 2. Can the its be plotted onto a ts? And is a correlation analysis in
> between the two objects possible?
A meaningful calculation of correlation normally requires the data to be
aligned in time (I can't think of an exception to this). So you need to
ensure that you have at least some of the data 'aligned' to start off with.
For example, if you have an 'its' x with daily data, and a 'its' y with
monthly data, you could do the following:
cor(intersectIts(x,y))
It relies for success on at least some subset of the POSIX dates being
equal, i.e. that the result of the intersect operation is not NULL.
Giles
**********************************************************************
This is a commercial communication from Commerzbank AG.\ \ T...{{dropped}}
More information about the R-help
mailing list