问题
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!
回答1:
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:
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.
Look at getAnywhere(plot.acf)
to learn how to calculate confidence intervals of type "ma".
来源:https://stackoverflow.com/questions/15551209/cross-correlation-using-ccf-in-r