简体   繁体   English

R中的互相关方式

[英]ways for cross correlation in R

For cross correlation of a bivariate time series, I use either ccf or acf to plot it, but the two plots are not the same. 对于双变量时间序列的互相关,我使用ccfacf来绘制它,但两个图不同。 The first plot by ccf agrees with the lefttop plot of acf , while the second plot by ccf doesn't agree with the rightbottom plot of acf . ccf的第一个图与acf的左图一致,而ccf的第二个图与acf的右底图不一致。

I wonder if I miss something? 我想知道我是否想念一些东西? Thanks! 谢谢!

par(mfrow = c(2,1))
ccf(x[,1],x[,2])     
ccf(x[,2],x[,1])     

在此输入图像描述

acf(x)  

在此输入图像描述

ACF measures correlations of a single time series against its own lags. ACF测量单个时间序列与其自身滞后的相关性。 CCF measures correlations between two time series at different lags. CCF测量不同滞后的两个时间序列之间的相关性。 What appears to be the same (first plot by ccf and the lefttop plot of acf) are actually different. 似乎是相同的(ccf的第一个图和acf的左图)实际上是不同的。 If you pulled out the values, I am sure you would see this. 如果你拿出价值观,我相信你会看到这个。 If the two time-series have a high correlation, it is very likely that the ACF and CCF would appear to be the same. 如果两个时间序列具有高相关性,则ACF和CCF很可能看起来是相同的。

The first plot of the CCF actually matches the bottomleft ACF plus topright ACF combined. CCF的第一个图实际上与底部ACF加上顶部ACF相结合。 The top left and bottom right ACF plots express only univariate time-series lag correlations. 左上角和右下角ACF图仅表示单变量时间序列滞后相关性。

If you enter a multivariate timeseries into the ACF function, it will return the auto-correlation plots (top-left and bottom-right) along with the two halves of the cross-correlation function. 如果在ACF函数中输入多变量时间序列,它将返回自相关图(左上角和右下角)以及互相关函数的两半。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM