# How to determine which measurements cause which?

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?

• Is this even possible in general? If x1 = x2 + 1, you could say that x2 came first and caused x1, or x1 came first and caused x2 = x1 - 1. Maybe, if you can establish that x1 = f(x2) where f is non-invertible, then x2 had to come first?
– MBaz
Commented Mar 3, 2021 at 22:26
• watching this. I could try to give a response, but I feel that there will be people better able to do.
– Bob
Commented Mar 4, 2021 at 9:54
• @MBaz Right, but in your example there are no dynamics. I'm wondering if one can make some assumptions about the dynamics relating the two measurements. See my update.
– Peter K.
Commented Mar 4, 2021 at 13:32
• If $h$ introduces a delay, then $g$ would have to be acausal, right? (or vice versa).
– MBaz
Commented Mar 4, 2021 at 18:33
• @MBaz Not really! I've read quite a bit. This long post by Michael Nielsen is quite interesting.
– Peter K.
Commented Oct 15, 2021 at 19:28