Using non-stationary time series in cross-correlation analysis 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?
 A: 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.
References:
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
A: 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
A: 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:
https://pubmed.ncbi.nlm.nih.gov/26100765/
https://online.stat.psu.edu/stat510/lesson/8/8.2
