1
$\begingroup$

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

enter image description here

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!

$\endgroup$
1
$\begingroup$

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.

enter image description here

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.

$\endgroup$
6
  • $\begingroup$ 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? $\endgroup$ – teeeeee Sep 14 '20 at 12:47
  • $\begingroup$ 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. $\endgroup$ – Eoin Sep 14 '20 at 13:02
  • $\begingroup$ Thanks - what does autocorrelation in the signal's derivate imply? And briefly, why is it a bad thing that we need to avoid? $\endgroup$ – teeeeee Sep 14 '20 at 14:50
  • 1
    $\begingroup$ 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). $\endgroup$ – Eoin Sep 14 '20 at 16:48
  • $\begingroup$ I see. But don't we also have to check for autocorrelation in the value itself? Why only the derivative? $\endgroup$ – teeeeee Sep 14 '20 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.