2

I am working on my bachelor thesis, where I want to look into the lagged cross-correlation of a timeseries of search query volumes (=x) to the price of bitcoin (=y).

I have already created several ccf-plots using the "ccf"-function in R .

See picture: (see pictures)

I saw in the description of R's acf-function that ccf only works with one y and one x series. I was wondering if someone knows a way to put several of those plots into one, especially since I can categorize positively correlated and negatively correlated ones.

Further I was wondering, the dashed-blue line representing the confidence value, but at what level? 0.05? 0.01?

dcsohl
  • 7,186
  • 1
  • 26
  • 44
yzioer
  • 21
  • 1

1 Answers1

0

These are two questions in one.

1. question: combine plots This question has been asked before. Please look it up:

2. question: confidence intervals in ccf-plot: The plot gives you the confidence intervals. The manual advises caution with these even though it uses ci.type = "white" is default setting. This default bluntly adds some confidence based on the quantiles of a standard normal distribution. It does not take the statistical properties of your data into account. In my opinion it is altogether useless. The manual recommends ci.type = "ma". But that will only work for autocorrelations. If you try using it with cross-correlations, you will get a warning saying "can use ci.type=‘ma’ only if first lag is 0". When doing autocorrelations the function shifts the sequences from -k to +k and will allow the first lag to be zero. ccf does not.

Further support

I hope it is not against the code of conduct to offer further support.

The ccf function has some pecularities that aren't well explained in the manual. Since I had trouble with ccf myself I wrote it all down here for everybody.

Because I wanted meaningful confidence intervals I developed an improved version of 'ccf' (link to repository in case anyone is interested) myself. It offers confidence intervals. The ccf-object by the new function is compatible with the output by stats::ccf() but contains more information. Additional functions make it more useful.

Jan
  • 4,974
  • 3
  • 26
  • 43