Solved – How to estimate the phase difference between two periodic time-series

fourier transformtime series

I have 2 daily time-series, each 6 years long. While noisy, they are both clearly periodic (with a frequency of ~1 year), but appear to be out of phase. I would like to estimate the phase difference between these time-series.

I've considered fitting curves of the form $a\sin(\frac{2\pi}{365}t – b)$ to each time-series and just comparing the two different values for b, but I suspect there are more elegant (and rigourous!) methods for doing this (perhaps using Fourier transforms?). I would also prefer to have some kind of idea of the uncertainty in my phase difference estimate, if possible.

Update:

Plot of the two time-series

The shaded regions are 95% CIs.

Sample crosscorrelation between the two time-series:
Sample crosscorrelation between the two time-series

Best Answer

This is the very problem cross-spectral analysis is good for. Next you have an example of code using consumer prices (in differences) and price of oil, and estimating the coherency (roughly, a squared correlation coefficient broken by frequency band) and phase (lag in radians, again by frequency band).

Crudo <- dget(file="Crudo.dge")
IPC <- dget(file="ipc2001.dge")[,1]
dIPC <- diff(IPC)
datos <- ts.union(dIPC,
           Crudo)
datos <- window(datos,
           start=c(1979,1),
           end=c(2002,1))
sp <- spectrum(datos,
           main="PetrĂ³leo e IPC",
           spans=rep(3,5))
par(mfrow=c(2,1))
plot(sp,plot.type="coh")
plot(sp,plot.type="phase")

These are the graphs produced by the last instructions. You can probably adapt this to your setup. enter image description here

Related Question