Statistical Methods
Check the Sign and Overlap of a Cross-Correlation Lag
Define the task
Cross-correlation can help audit alignment between two sampled sequences, but the sign of a lag depends on the stated convention. Preserve which sequence is first, the sample interval, and whether values were centered, standardized or filtered. This tool uses real-valued sequences with zero values outside their observed ranges. Its output is an unnormalized sum of products, not a Pearson correlation coefficient or a significance test.
Carry out the check
At lag k, sum x[i] times y[i−k] over overlapping valid indices. Evaluate lags from minus (length of y minus one) through length of x minus one. Inspect overlap counts with each sum: extreme lags use fewer products. Nonzero baselines and unequal amplitudes can dominate the largest sum. Do not infer a physiological delay from a peak without reviewing timing precision, trends and the acquisition process. Record tied peaks instead of choosing a convenient one after inspection.
Worked hypothetical example
For fictional x=(1,2) and y=(3,4), lags −1,0,1 give sums 4,11,6 with overlaps 1,2,1. Reversing sequence order reverses the lag axis. If sampling is every 0.2 seconds, a lag of one corresponds to 0.2 seconds under this convention. These arithmetic values verify alignment only. Negative sums are valid, and the largest positive sum is not necessarily the largest absolute association. Keep raw sequences and preprocessing settings with the result.
Method checked 19 November 2026 against Primary method documentation: correlate.