I have a TS object in R with 78 variables. These all represent different macroeconomic indicators. The last variable is a balance of some kind that I want to compare each of these indicators. Currently I have been using the ccf() function to do this.
I am wondering about the stationarity of my TS and have a few questions:
When comparing time series using ccf(), do both time series need to be stationary?
- Currently my independent variable (the balance I am comparing to the macroeconomic indicators) is not very stationary, with an adf test p-value of 0.17.
If they do both need to be stationary as I suspect, what is the easiest way to do this in R? Some of these 78 variables are stationary and some are not.
- I have thought about using diff() to take the difference of my independant variable and comparing it with the dependants as seen here: https://towardsdatascience.com/cross-correlation-of-currency-pairs-in-r-ccf-d27eec2d4b91.
- However in that example both of the variables are differenced then compared. In mine only some would need to be differenced as only some have an adf-test p-value above 0.05.
To Summarize my three questions are:
- When comparing time series using ccf(), do both time series need to be stationary?
- If they do both need to be stationary as I suspect, what is the easiest way to do this in R?
- If the diff() function is a good way to accomplish this, can I difference only one variable to bring the adf-test p-value down to below 0.05? Or do both variables need to be differenced to compare them?