Search code examples
rtime-seriesnormalizecross-correlation

Does scaling time series (using min/max scaling) affect cross-correlation?


I have two time series and I want to find the correlation between them. However, they were on completely different scales before, so I thought I should normalize them between 0 and 1 to have a better understanding of what is going on. To do so, I did something along the lines of:

ts1 <- ts1$price-min(ts1$price)/(max(ts1$price)-min(ts1$price)
ts2 <- ts2$price-min(ts2$price)/(max(ts2$price)-min(ts2$price)

However, when I compute the cross correlation before and after normalizing (using the ccf function in R), I get the same thing. Should that happen? Does scaling time series not affect cross-correlation (or is that I am scaling both time series and therefore the effect cancels out)? I would definitely like to have greater intuition about how this works.

Thanks!


Solution

  • That's exactly as expected, no worries.

    Translations (subtracting a constant) and scaling (multiplying by a constant) have no affect on correlation. Since a min/max scaling is simply the combination of a translation and a scaling (with no shear) it has no affect on cross-correlation.

    This is easy to understand if you remember that the definition of correlation already subtracts off the mean of both datasets (making it invariant under translations) and divides by the sums of squares at the end (making it invariant under scaling operations.)