# What is a suitable way to reveal correlation between these two signals?

I have two time-domain data signals which look like the following:

I know that variations in $$x$$ are able to induce variations in signal $$y$$, and would like to be able to show that "yes, x is correlated with y". I am looking for some advice on what would be a good method to use to analyse such signals.

Pearson coefficients don't work directly because the changes in $$y$$ are not linear with $$x$$. Instead, for these signals, a change in $$x$$ leads to oscillations in $$y$$ - and the faster rate of change in $$x$$ the greater the amplitude and frequency of those oscillations.

Thank you!

# 1. Calculate the Envelope

The envelope $$y(t)$$ captures the instantaneous power of the oscillations (see the plot, where the envelope is in red), which I think is what you're looking for. The wiki page on the analytic function is a good place to start for this.

# 2. Be Careful of Autocorrelation

As discussed here, you can't just correlate two time series. There's lots of good advice in the linked question, but the simplest thing you can do is to differentiate the two signals, $$\frac{dx(t)}{dt} = x(\tau) - x(\tau-1)$$ for all values of $$\tau$$, check that there's no autocorrelation in the differentiated signals, and then correlate them.

Actually, since you're interested in how the rate of change in $$x$$ predicts oscillatory power in $$y$$, you need to first calculate the second derivate of $$X$$ (reflecting change in the rate of change, or acceleration/deceleration), and correlate it with the first derivate of envelope of $$y$$ (reflecting change in power).

In pseudo-code:

ddx = diff(diff(x))
power_y = envelope(y)
d_power_y = diff(power_y)
cor.test(ddx, d_power_y)


For the frequency of the oscillations in $$y$$, you can do the same thing with the instantaneous frequency.

• Thanks Eoin for your answer. Could you expand a little more. Are you saying to calculate the envelope and then do Pearson with between $x$ and the instantaneous power instead? Sep 14 '20 at 12:47
• Yes, but before you can do that correlation you need to deal with the autocorrelations in the two time series. How to do that is already well-covered in the linked question, so I won't repeat it all here.
– Eoin
Sep 14 '20 at 13:02
• Thanks - what does autocorrelation in the signal's derivate imply? And briefly, why is it a bad thing that we need to avoid? Sep 14 '20 at 14:50
• There's a lot of material in the linked question, and this is beyond the scope of your original question, so I won't go into detail. Autocorrelation in the derivative means that the change at time $t$ is correlated with the change at time $t+1$. This is true of any time series that isn't a straight line or a random walk. This is bad because a standard correlation test assumes individual pairs of data points are independent (not autocorrelated), so running it on autocorrelated data gives your spurious results (again, see the linked question).
– Eoin
Sep 14 '20 at 16:48
• I see. But don't we also have to check for autocorrelation in the value itself? Why only the derivative? Sep 14 '20 at 17:36