Abstract
We describe two families of statistical tests to detect partial correlation in vectorial timeseries. The tests measure whether an observed timeseries $Y$ can be predicted from a second series $X$, even after accounting for a third series $Z$ which may correlate with $X$. They do not make any assumptions on the nature of these timeseries, such as stationarity or linearity, but they do require that multiple statistically independent recordings of the 3 series are available. Intuitively, the tests work by asking if the series $Y$ recorded on one experiment can be better predicted from $X$ recorded on the same experiment than on a different experiment, after accounting for the prediction from $Z$ recorded on both experiments.
Introduction: The Challenge of Nonsense Correlations
In fields like neuroscience or economics, researchers often deal with timeseries data where observations are autocorrelated—meaning what happens at time $t$ is highly dependent on what happened at $t-1$. Standard statistical tests, such as the Pearson correlation, assume every data point is independent and identically distributed (i.i.d.). When applied to timeseries, these standard tests frequently yield "nonsense correlations": two completely unrelated signals appearing statistically significant simply because they both share a similar trend or internal structure.
While methods exist to "fix" this, such as filtering or assuming stationarity, these often fail in real-world scenarios where signals are nonstationary or nonlinear. This paper addresses the specific challenge of partial correlation: how do we know $X$ and $Y$ are actually linked, and not just both reacting to a third variable $Z$, without making rigid assumptions about the data's underlying nature?
Methods: Leveraging Experimental Repetition
The proposed tests rely on having multiple independent repetitions (trials or sessions) of the same experiment. The core intuition is that if $X$ truly helps predict $Y$, then $X$ from Trial $i$ should be a better predictor of $Y$ from Trial $i$ than $X$ from Trial $j$ would be, even after controlling for $Z$.
- Test 1: Approximate Test via Orthogonal Projections. This test uses linear algebra to "project out" the influence of the confounding variable $Z$. It calculates a statistic ($G_i$) for each trial comparing "within-trial" vs "across-trial" predictability. A standard t-test is then applied to these trial-specific statistics.
- Test 2: Exact Test via Permutation. This is a more rigorous approach that controls the Type 1 error rate exactly. It projects out the influence of $Z$ across all trials simultaneously and uses a session permutation method to create a null distribution.
Crucially, both tests allow the user to choose their own measure of predictability (e.g., Pearson correlation, ridge regression, or deep learning models), making the framework highly flexible for high-dimensional vectorial timeseries.
Datasets and Validation
The authors validated these tests using synthetic datasets designed to mimic difficult real-world conditions. $X$ and $Y$ were constructed as sums of two "step functions" plus independent noise. One step function (the confounder $Z$) was constant across all trials, while the other occurred at different times in different trials, representing a unique trial-specific relationship.
Key Results
In simulations where $X$ and $Y$ were only related through $Z$, both tests correctly reported no significance (p > 0.05). However, when a genuine partial correlation existed beyond $Z$, both tests successfully detected it.
Test 1 is computationally simpler and works well if the data is roughly symmetric. Test 2 is more robust for small sample sizes because it provides an "exact" p-value through permutation. Because the tests compare trials to each other rather than timepoints within a single trial, the internal structure of the timeseries becomes a feature rather than a source of error.
Discussion and Limitations
The primary requirement for these tests is the availability of multiple independent trials; they cannot be used on a single, long timeseries (like a single multi-year stock market record). Additionally, all timeseries must have the same number of time points. Despite these requirements, the framework offers a powerful, measure-agnostic way to break the "nonsense correlation" trap in complex datasets.
Summary updated