在 R 中使用 ccf 进行互相关 [英] cross-correlation using ccf in R

查看:210
本文介绍了在 R 中使用 ccf 进行互相关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 R 中使用 ccf 来计算两组时间序列数据的互相关.我的问题是如何知道图中的任何相关系数是否落在蓝色虚线之外,而无需手动查看?因为我有数万组时间序列数据要处理.提前致谢!

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!

推荐答案

这里是计算置信区间的方法:

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)

然而,help(plot.acf) 警告:

plot.acf 中绘制的置信区间基于不相关的系列,应适当谨慎对待.使用 ci.type = "ma" 可能不会产生误导.

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.

查看 getAnywhere(plot.acf) 以了解如何计算ma"类型的置信区间.

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

这篇关于在 R 中使用 ccf 进行互相关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆