1
$\begingroup$

2 time series, which looked like highly correlated. I want to prove it with CCF.

CCF stands for cross-correlation. In this case, I used R ccf (cross-correlation) function.

enter image description here

With direct CCF:

fe <- c(15,24,36,40,50,68,71,86,88,81,84,85,102,120,124,124,128,134)
ma <- c(317,331,347,353,368,382,395,411,417,418,454,460,469,480,493,503,516,522)

female <- ts(fe, frequency = 1, start=c(1950))
male <- ts(ma, frequency = 1, start=c(1950))

ccf(male, female)

Am I right here, they are highly correlated with zero lags?

enter image description here

With differencing:

ccf(diff(male), diff(female))

enter image description here

It shows no correlation.

What is the best way to find out the correlations between two time series?

p.s. This question is specifically related to CCF, from time series’ point of view and trying to understand if there's a lagging factor, not Pearson correlation.

Thannk you.

$\endgroup$
7
  • $\begingroup$ Possible duplicate of How to use Pearson correlation correctly with time series $\endgroup$
    – Dayne
    Commented Sep 27, 2019 at 9:25
  • $\begingroup$ What is CCF? It's not a common acronym, so please spell it out. $\endgroup$
    – Peter Flom
    Commented Sep 27, 2019 at 14:10
  • 2
    $\begingroup$ @Peter Flom, CCF stands for cross-correlation. In this case, I used R ccf (cross-correlation) function. $\endgroup$
    – Mark K
    Commented Sep 27, 2019 at 14:48
  • 2
    $\begingroup$ @Peter You're right: it doesn't hurt to spell out acronyms and abbreviations; and often that is necessary. But it's not always necessary to close a question that relies on one acronym whose meaning is readily inferred from the context. My test is this: if I don't know the subject but can easily guess the meaning of an acronym and confirm it with a quick Web search, it's probably safe to assume the question is understandable by those who know enough to answer it. $\endgroup$
    – whuber
    Commented Sep 27, 2019 at 19:26
  • 1
    $\begingroup$ steps for performing CCF explained here: stats.stackexchange.com/questions/418894/… $\endgroup$ Commented Jul 25, 2020 at 19:59

1 Answer 1

0
$\begingroup$

Found below in a book. Just post it here for reference in case it helps anyone.

According to Page 267, Time Series Analysis With Applications in R, Second Edition, by Jonathan D. Cryer • Kung-Sik Chan, Springer

"The specification of which lags of the covariate enter into the model is often done by inspecting the sample cross-correlation function based on the prewhitened data."

Prewhiten in R is different from Differencing. It seems Differencing shouldn't had been performed for this case.

$\endgroup$
6
  • $\begingroup$ I think you’re misinterpreting the quote. You want to calculate the sample ccf on stationary data and you want to make sure at least one of the series is white. In this case, differencing gives you stationarity, and prewhitening may or may not be necessary. You’ll want to look at the acf of both differenced series. If neither is white then the sampling distribution of the ccf would have more error without prewhitenig. If one is white, then no prewhitening is necessary. $\endgroup$
    – Taylor
    Commented Jun 30, 2023 at 2:46
  • $\begingroup$ @Taylor, thanks for looking into it. $\endgroup$
    – Mark K
    Commented Jun 30, 2023 at 2:55
  • $\begingroup$ @Taylor: I'm not disagreeing with your approach, I'm just wondering where you got the information that, if one series is white, then no pre-whitening on the other series is necessary. In fact, if you know of a good general reference for this topic ( pre-whitening for ccf ), it's appreciated. I have a lot of time-series related books but I don't know of a good discussion on this topic. Thanks. $\endgroup$
    – mlofton
    Commented Nov 2, 2023 at 5:47
  • $\begingroup$ Note that transfer-response (in time domain) and pre-whitening are related ( AFAIK) so a good discussion of either one is useful for me. Thanks. $\endgroup$
    – mlofton
    Commented Nov 2, 2023 at 8:57
  • 1
    $\begingroup$ @Taylor : I missed this and am just seeing it now by accident so thanks for link. $\endgroup$
    – mlofton
    Commented Mar 21 at 4:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.