# Lead time determined through correlation between a non-stationary and stationary time series

An analytic platform takes a sales data and runs it against individual external indicators ( macroeconomic, climate data etc.) to find the predictive indicators. For a given indicator, they calculate the correlation between the sales data and the indicator (with its lags), the lag which gives the highest correlation is said ‘lead time’. For example, lead time is 1, the sales data is correlated with the indicator’s past month.

Before they calculate the correlations, they remove the seasonality from the sales data. I believe to do correlation analysis between two time series they both need to be stationary, a great explanation is here Does correlation assume stationarity of data?.

But a very similar question is asked here Identifying Early Indicators Time Series Analysis and one response was ‘ you said: Make product demand series and indicator candidate series stationary (for example through differencing) I say : Not necessarily as you my be vitiating the importance of the predictor series by pre-empting the effect’.

Because removing only seasonality doesn’t make the sales data stationary if it has a trend, the determined lead times would be the result of correlations analysis between a non-stationary and stationary data (assuming the indicator is stationary). My question is can these lead times still represent the true lead times? Should the sales data be made stationary or not? I appreciate your answer. Thanks

(P.S. The analytic platform does not use ARIMAX, to predict the sales, they simply calculate the correlations (Pearson) with each indicator and apply multiple regression with the chosen indicators lags.)

On the one hand, I would indeed try to make series stationary as far as possible. Both your focal series and the potential predictor may be driven by the same underlying factor (with different lags), so any correlation between them may be entirely due to the underlying factor. (I am not saying this is "spurious".) For instance, ice cream sales are higher when it is warm, and it is warmer in summer, so does our correlation between temperature and sales really tell us anything beyond seasonality? Also, we will usually have more promotions on ice cream in summer, so how does this get factored in?

On the other hand, of course any transformation to make your data "stationary" may lose information, as per the linked thread. Plus, consider that promotion again: it is an intervention variable, and the whole point of it is that it is nonstationary, and there is really no way to make it stationary, except for regressing sales on it and taking residuals from that model (to make the sales series "more stationary") and discarding the promotion series entirely - but that approach presupposes what you are trying to figure out, namely the optimal lag.

On the third hand, [stationarity}(https://en.wikipedia.org/wiki/Stationary_process) is a slippery and often misunderstood concept.

a stationary process ... is a stochastic process whose unconditional joint probability distribution does not change when shifted in time

A seasonal or trended series is nonstationary. But so is one with changes in variance or in higher moments, and such kinds of nonstationarity are much harder to address. Yes, you can fit a GARCH model to the series. But how much good will that do to you if you haven't yet removed the effect of a predictor, because understanding the lag order of that effect is the reason why you want to make your focal series stationary in the first place?

On the fourth hand, if your overall goal is to find the predictor that most improves your forecast (and I'm biased: I would argue that any analysis that only looks at past data and does not assess improvements in predictive accuracy is iffy), I would indeed much more trust modeling the predictor at various lags and checking at which lag it improves forecast accuracy. Ideally, the choice of predictor and lag or lead time should be driven by domain expertise, and in forecasting, care should be taken to distinguish cases where we know the future value of the predictor from cases where we don't. Too many people use "temperature" to improve their models, but use actual rather than forecasted temperature for the forecast horizon.

Finally, every single one of these approaches is of course very susceptible to overfitting and misplaced confidence, especially if we allow for long lags, and keeping in mind that it is always easy to find "explanations" for why the predictor is correlated with the focal series at some large lag. Looking at forecast improvement mitigates this to a degree, as does talking to domain experts before running the analysis (because they are as good at rationalizing a spurious correlation after the fact as anyone else).