[R] Lag representation in ccf() while zoo object is used?

Keith kigiokli at gmail.com
Fri Jul 24 16:31:14 CEST 2009


Dear All,

I have 2 time-series data sets and would like to check the cross
correlation. These data sets were set as a zoo object, called data,
and in general look like:

                                        V1             V2
2007-01-01 00:00:00      0.0   0.176083
2007-01-01 01:00:00      0.0   0.176417
2007-01-01 02:00:00      0.0   0.175833
2007-01-01 03:00:00      0.0   0.175833
2007-01-01 04:00:00      0.3   0.176000
2007-01-01 05:00:00      1.8   0.176250
2007-01-01 06:00:00      2.0   0.177583
2007-01-01 07:00:00      0.2   0.178333
2007-01-01 08:00:00      0.3   0.178167
2007-01-01 09:00:00      3.2   0.178417

When I applied the ccf method, ccf(data$V1, data$V2), I noticed the
lag is every 3600 which is a little surprising to me. I was thinking
the lag should be 1, but it seems the lag unit becomes 3600. I guess
the number 3600 representing 3600 "seconds" because of the zoo object.
I am not sure if I'm right and would like someone here could certify
this (or not). Besides, does anyone know any default argument to
adjust the 3600 into 1 while plotting? The only idea I have is to
divide the lag manually by 3600 and then plot it later.

Regards,
Keith




More information about the R-help mailing list