Suppose I have two sequences of measurements, $x_1[n]$ and $x_2[n]$ for $0 \le n \le N-1$.
How do I determine if there is a causal relationship between the two?
My first thought was, well... I can just find the correlation between $x_1$ and $x_2$. But almost immediately I was struck by correlation is not causation.
OK, so in Python, we can generate a uniform noise signal x1
and then filter it to get x2
. Clearly, in this case, x2
is causally related to x1
.
import numpy as np
import scipy.signal as signal
Q = 50
N =1000
x1 = np.random.uniform(-1,1,N)
b,a = signal.iirfilter(1,[2*500*(1-1/(2*Q))/44100,2*500*(1+1/(2*Q))/44100])
x2 = signal.lfilter(b,a,noise1)
x1
x2
Unfortunately, the correlation of the two doesn't tell us much:
Next, I thought about using coherence:
$$ C_{x_1x_2}(\omega) = \frac{|G_{x_1x_2}(\omega)|^2}{G_{x_1x_1}(\omega) G_{x_2x_2}(\omega)} $$
where $G_{ab}$ is the cross-spectral density between $a$ and $b$.
However, this just seems to tell me that the two are causally related... it doesn't tell me the direction of the causation.
The figure above shows what should be obvious: $C_{x_1x_2}(\omega) = C_{x_2x_1}(\omega)$.
So... how do I determine the direction of the causation?
For example, suppose I want to know whether $x_1$ caused $x_2$, or vice versa.
So either $$ x_1 = h \star x_2 $$ or $$ x_2 = g \star x_1 $$ where $\star$ is convolution, and $h$ and $g$ are the impulse responses of LTI systems. Presumably, $g$ is the inverse of $h$ so that $g \star h = 1$.
Is it possible that both $g$ and $h$ are stable and causal?
x1 = x2 + 1
, you could say thatx2
came first and causedx1
, orx1
came first and causedx2 = x1 - 1
. Maybe, if you can establish thatx1 = f(x2)
wheref
is non-invertible, thenx2
had to come first? $\endgroup$