I have modelled organism dynamics and abiotic factors time series in order to understand their seasonal oscillation and trend over time. Now I want to identify if there are any correlation between environmental variations and a lagged biotic response, using the cross-correlation function (ccf::stats).

Most of my biotic time series are not stationary, and even the detrended time series or residual series aren't either. I've realized differencing (using diff::stats) the time series changes drastically the structure, so I don't think it is very reasonable to use this approach. Since stationarity is fundamental for cross-correlation analysis, what alternative should I try?

  • $\begingroup$ can you please mention the way you calculated cross-correlation for two non-stationary time series? $\endgroup$ Dec 11, 2020 at 12:16

3 Answers 3


I've found the correlation between two non-stationary time series can be studied using Detrended Cross Correlation Analysis - DCCA (Horvatic et al., 2011; Zebende, 2011) even applying lags to the time series (Chenhua, 2015), being one refered to as signal (for example, an environmental variable) and the other as response (for example, a biotic community dynamics variable).

Unfortunately, I couldn't find any R function that encodes this analysis. Therefore, I'm working on an algorithm (for R) based on Chenhua's work. As soon as I use the implemented DCCA algorithm for analyzing my data, I might share a R package containing a DCCA function.


Horvatic et al., 2011. Doi: 10.1209/0295-5075/94/18007

Zebende, 2011. Doi: doi:10.1016/j.physa.2010.10.022

Chenhua, 2015. Doi: 10.1016/j.physleta.2014.12.036


You might want to look at https://web.archive.org/web/20160216193539/https://onlinecourses.science.psu.edu/stat510/node/75/ as to how to use filtered not simply detrended series to identify the TF model AND http://www.math.cts.nthu.edu.tw/download.php?filename=569_fe0ff1a2.pdf&dir=publish&title=Ruey+S.+Tsay-Lec1 which details the algebra. You can safely ignore Tsay's recommendation on how to identify the TF model as it is not robust to outliers.

AUTOBOX a piece of software that I helped to develop automatically identifies the TF model http://viewer.zmags.com/publication/9d4dc62a#/9d4dc62a/66 . Following it might be useful to help you understand what can be done to obtain preliminary model identification and the subsequent iterative process to self-check and alter. https://autobox.com/cms/index.php/news/48-autobox-software-review-in-orms presents a review of the automatic TF procedure using the gasx/gasy problem from Box & jenkins https://books.google.com/books?id=XY8ECAAAQBAJ&pg=PA544&lpg=PA544&dq=has+gas+problem+box-jenkins&source=bl&ots=3BLiXEob4C&sig=ACfU3U0AG2rw-BIYocsiBDWOnWNf4nJMFQ&hl=en&sa=X&ved=2ahUKEwjA4t6a8YThAhUm2FkKHasBBOcQ6AEwCXoECAEQAQ#v=onepage&q=has%20gas%20problem%20box-jenkins&f=false.

Follow https://autobox.com/pdfs/A.pdf

  • $\begingroup$ I've seen onlinecourses.science.psu.edu/stat510/node/75 before deciding to use DCCA for my data. I decided not to use the pre-whitening strategy, because the residuals of the ARIMA models I could fit were not stationary. My knowledge about modelling is still starting to grow, so I may have done something inaccurately. However, as ccf assumes stationarity of data, I thought DCCA would be a better option for analyzing my data. Still, I thank you for the suggestion! $\endgroup$ Mar 28, 2019 at 16:53
  • $\begingroup$ "because the residuals of the ARIMA models I could fit were not stationary" ... that is all on you and I would like to possibly help you with that.. That being the case requiring us to share data and screens as we pursue this issue ,,, it might be better to pursue this offline. $\endgroup$
    – IrishStat
    Mar 28, 2019 at 20:59

I don't know if the links below give answers to your question but they look useful andrelated to the topic. Disclaimer: I didn't read them and just glanced so you never know with these things. Also, they could have already mentioned in the other two answers:



  • $\begingroup$ CV community standards value link-in-place-of-substantive answers less than substantive answers. $\endgroup$
    – Alexis
    Sep 14, 2021 at 4:18

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.