在R中使用ccf的交叉相关。

时间:2021-08-15 07:36:31

I wanted to use ccf in R to compute the cross-correlation on two sets of time-series data. My question is how can I know if any of the correlation coefficients in the plot falls outside the dash blue lines without manually looking at it? Since I have tens of thousands sets of time-series data to deal with. Thanks in advance!

我想在R中使用ccf来计算两组时间序列数据的相互关联。我的问题是,我怎么能知道,在没有手动查看的情况下,图中的任何相关系数是否落在了虚线之外?因为我有成千上万的时间序列数据来处理。提前谢谢!

1 个解决方案

#1


5  

Here is the way to calculate the confidence intervals:

下面是计算置信区间的方法:

res <- ccf(mdeaths, fdeaths, ylab = "cross-correlation")

upperCI <- qnorm((1 + 0.95)/2)/sqrt(res$n.used)
lowerCI <- -qnorm((1 + 0.95)/2)/sqrt(res$n.used)

However, help(plot.acf) warns:

然而,帮助(plot.acf)警告说:

The confidence interval plotted in plot.acf is based on an uncorrelated series and should be treated with appropriate caution. Using ci.type = "ma" may be less potentially misleading.

置信区间绘制在图中。acf基于一个不相关的系列,应该谨慎对待。使用ci。type = "ma"可能不那么具有误导性。

Look at getAnywhere(plot.acf) to learn how to calculate confidence intervals of type "ma".

看看getAnywhere(plot.acf)如何计算“ma”类型的置信区间。

#1


5  

Here is the way to calculate the confidence intervals:

下面是计算置信区间的方法:

res <- ccf(mdeaths, fdeaths, ylab = "cross-correlation")

upperCI <- qnorm((1 + 0.95)/2)/sqrt(res$n.used)
lowerCI <- -qnorm((1 + 0.95)/2)/sqrt(res$n.used)

However, help(plot.acf) warns:

然而,帮助(plot.acf)警告说:

The confidence interval plotted in plot.acf is based on an uncorrelated series and should be treated with appropriate caution. Using ci.type = "ma" may be less potentially misleading.

置信区间绘制在图中。acf基于一个不相关的系列,应该谨慎对待。使用ci。type = "ma"可能不那么具有误导性。

Look at getAnywhere(plot.acf) to learn how to calculate confidence intervals of type "ma".

看看getAnywhere(plot.acf)如何计算“ma”类型的置信区间。