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.


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

  • $\begingroup$ A plot would be interesting and, potentially, helpful. How close to sinusoidal are the two series? $\endgroup$
    – cardinal
    Commented Jan 13, 2012 at 0:20
  • $\begingroup$ Hi Cardinal. I have a plot, but need 10 reputation points to upload it, unfortunately! I'll do so as soon as that happens. The time-series are related to temperature and vegetation growth, so follow pretty consistent seasonal behaviour, although it is noisy. Without having seen the plots, do you have any thoughts on how to approach this problem? $\endgroup$ Commented Jan 13, 2012 at 1:21
  • $\begingroup$ Yes. I have a couple ideas, but I'd like to see a plot first to have a better idea of what you're dealing with. if you upload your plot to imgur and edit the post to provide the link, then I can edit it yet again to put the image inline. The rep will come soon enough. Welcome to the site. $\endgroup$
    – cardinal
    Commented Jan 13, 2012 at 1:26
  • $\begingroup$ For some reason, maybe my currently-crippled machine, I can't click on a link or see a plot. $\endgroup$
    – jbowman
    Commented Jan 13, 2012 at 1:54
  • 3
    $\begingroup$ As a very first quick-and-dirty check, have you tried plotting the sample crosscorrelation between the two series and finding the peak? There are some curious discontinuities, e.g., in the first series sometime around Feb 2005 or so. $\endgroup$
    – cardinal
    Commented Jan 13, 2012 at 2:00

1 Answer 1


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,
datos <- window(datos,
sp <- spectrum(datos,
           main="Petróleo e IPC",

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


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.