R 中的时间延迟(以分钟为单位)

time lag in minutes in R

我每 5m 采样一次数据,我想估计它们之间的 ccf, 为了做到这一点,我将时间序列 x 和 y 预白化,然后应用 CCF 但是滞后与我的采样频率没有直接关系, 我怎么知道这种关系?例如,延迟 -1000 分钟的关系是什么?

   row.names    fecha   y   x
1   53542   2012-10-20 00:00:00 1.1055  1.0219
2   53543   2012-10-20 00:05:00 1.1059  1.0164
3   53544   2012-10-20 00:10:00 1.1003  1.0201
4   53545   2012-10-20 00:15:00 1.1015  1.0441
5   53546   2012-10-20 00:20:00 1.1090  1.0224
6   53547   2012-10-20 00:30:00 1.1136  0.9965
7   53548   2012-10-20 00:35:00 1.1140  1.0017
8   53549   2012-10-20 00:40:00 1.1118  1.0379
9   53550   2012-10-20 00:45:00 1.1141  1.0234
10  53551   2012-10-20 00:50:00 1.1128  1.0092
11  53552   2012-10-20 00:55:00 1.1123  1.0232
12  53553   2012-10-20 01:00:00 1.1167  1.0656
13  53554   2012-10-20 01:05:00 1.1195  1.0266
14  53555   2012-10-20 01:10:00 1.1205  1.0142
15  53556   2012-10-20 01:15:00 1.1122  1.0486
16  53557   2012-10-20 01:20:00 1.1168  1.0196
17  53558   2012-10-20 01:30:00 1.1116  1.0070
18  53559   2012-10-20 01:35:00 1.1117  0.9783
19  53560   2012-10-20 01:40:00 1.1170  0.9589
20  53561   2012-10-20 01:45:00 1.1198  1.0070
21  53562   2012-10-20 01:50:00 1.1126  0.9907
22  53563   2012-10-20 01:55:00 1.1190  1.0191
23  53564   2012-10-20 02:00:00 1.1162  0.9625
24  53565   2012-10-20 02:05:00 1.1206  0.9517
25  53566   2012-10-20 02:10:00 1.1237  0.9545
26  53567   2012-10-20 02:15:00 1.1168  0.9894
27  53568   2012-10-20 02:20:00 1.1225  0.9832
28  53569   2012-10-20 02:25:00 1.1239  1.0424
29  53570   2012-10-20 02:30:00 1.1272  1.0140
30  53571   2012-10-20 02:35:00 1.1304  1.0103

library(forecast)
fit <- Arima(x,order=c(2,0,2))
yfiltered <- residuals(Arima(y,model=fit))
ccf(residuals(fit),yfiltered)

滞后绝对以秒为单位,并且与您的观察结果一致。这只是密谋问题。您可以在绘图之前将延迟转换为观察次数:

ccf.out=ccf(residuals(fit),yfiltered, plot=F)
ccf.out$lag=ccf.out$lag*frequency(x)
plot(ccf.out)