# Methodology of cross-correlation of two time series

I have two time series. They are the same length of 3 years and each with one variable. I want to know if the two time series are correlated at a certain time point - 1 month, 2 month, 3 months etc. So, in other words does a value of X at month 1 in time series 1 correlate with a value of Y at month 3 in time series 2.

I have created code in python that automatically calculates .corr() at each lagged time point for me by referencing this article (https://stackoverflow.com/questions/33171413/cross-correlation-time-lag-correlation-with-pandas/55490747). But, I want to make sure my methodology is correct.

I'm running the correlation analysis on the absolute values of the two time series. I'm wondering if I should instead be running the correlation analysis on the % difference of values (month 2 - month 1 / month 1 value).

Guidance and suggestions are appreciated as I'm new to this type of analysis.

If the time series have trends in them then you will have spurious regression unless they are cointegrated or you address this various ways. ARIMA with input variables (regression with ARIMA error), Arimax (which involves prewhitening the two series), ARDL, and VAR/VECM are all some of the ways this has been addressed.

You could get lucky. Check the two series with unit root tests (I suggest both KPSS and ADF). They might both be stationary.

• That's a good point, I will make sure to run an ADF. As for the % difference vs absolute values in determining correlation, is there one preferred way over the other? @user54285 Aug 18, 2020 at 14:50
• I don't know what you mean by absolute values. I have not run across that terminology in the literature. There is an emphasis on stationary data before you analyze anything unless cointegration exists, and then in the form of error correction models. But I am hardly an expert. Aug 18, 2020 at 22:59