Hi, I'm totally new and not so good at figuring out how to test whether one series acts as a leading indicator to another series. Essentially, I'm trying to figure out whether there's a time-lag between the two series. Here's a more technical explanation:

"Mathematically, leading and lagging indicators are correlations where the maximum correlation is observed with a temporal
offset between the two observables being compared. In this technique, the offset is created by adding a constant value to the
time of one set of observations. The correlation coefficient between the two sets of observations is then calculated using the
observed times for one set and the offset times for the other set. To find leading and lagging indicators, a series of incremental
offsets may be used, with the correlation coefficient calculated for each offset amount. Where a high level of correlation or
anti-correlation is found, the offset with the highest absolute correlation coefficient may indicate the presence of a time lag
between two related events." (source: http://www.lexjansen.com/nesug/nesug12/fi/fi03.pdf)

If anyone has an idea of how to implement this, I would be very grateful. Thanks in advance!