# Reliability of normalized cross-correlation with high lags

Say you have two signals with 100 data points in each signal. Then there are 20 time lags where the computation of the normalized cross-correlation between those signals only considers 10 or less pairs of data points. It seems like the normalized cross-correlation is less meaningful at these lags because it is computed from less data. My question is, is there a general way of accounting for the uncertainty introduced when we look at the correlation with higher lags? Or does that vary too much based on the context?

## 1 Answer

Describing "correlation" as just a sample by sample multiplication and then a sum of the products of your two data sets [note that I am calling them data sets, not signals to avoid later confusion], correlated components will increase in magnitude at rate N (20Log N in dB), while independent components will increase in magnitude at the square root of N (10Log N in dB). If we consider the correlated components as the "Signal" of interest and the independent components as noise, we can see that we get a 20Log N - 10Log N = 10LogN increase in SNR due to the process of correlating.

With that in mind, consider your example if the first data set is a signal of interest "buried" in noise. Let's say it is a pseudo-random sequence, which is nice for this explanation in that we will get a sharp correlation at one delay and minimum correlation elsewhere. The second data set is the pseudo-random sequence itself. We correlate to find the presence of the sequence in the noisy data set, along with the delay (the lag where we get maximum correlation). Now here you should see the answer to your question in light of my description above: Assume the sequences are completely aligned in the two 100 sample datasets (lag=0), in this case we get 100 samples where the signal accumulates in the correlation, to 100x= 40 dB, while the noise component accumulates to sqrt(100x) = 20dB, and therefore you got a 20 dB net processing gain in SNR due to your 100 samples (important! Assuming here the noise from sample to sample in the first data set is independent, meaning white in frequency).

Now consider the sequences are not aligned until you are at a lag of 90 samples, such that only 10 samples really are multiplied and then summed. In this case the signal accumulates by 10x or 20dB and the noise accumulates by sqrt(10) = 10dB for a net processing gain in SNR of 10 dB.

• .' That was really interesting to read your correlation description because correlation for statisticians is not really viewed that way (AFAIK ? ). I'm new to DSP ( I think I'm gonna be new forever but that's ok with me ) and I'm not claiming to understand everything you said but do you know of "signal processing books" that speak your correlation language. it's definitely not stat language !!!!!! My guess is the Stephen Kay text because I see that recommended or mentioned a lot. I don't have it but I guess it would be my next step after I get the basic DSP stuff down.Thanks. – mark leeds May 24 '18 at 20:22
• Hi @markleeds ! Thanks for your comment. Yes this is clearly from the signal processing view and specifically the wireless communication field that I am from. Lookup the formula for the Pearson Correlation Coefficient which is likely closer to your recollection: en.wikipedia.org/wiki/Pearson_correlation_coefficient , (specifically the final formula given for r). The "multiply and sum" which is the correlation process I speak of is given there. – Dan Boschen May 26 '18 at 13:53
• The rest is subtracting out the mean and then dividing by the product of the standard deviations which serves to normalize the result to be within [-1, +1]. As for signal processing implementations of "correlators", it is often just simply the sample by sample sum of the products between the two sequences that are being correlated (usually a noisy input and a known clean reference signal). The result is a scaled correlation magnitude along the lines of what I describe. Hope this helped! This may also help: astronomy.swin.edu.au/cosmos/C/Correlator – Dan Boschen May 26 '18 at 13:55
• HI Dan: Yes, the pearson correlation part is definitely familar to me. Thanks for the info that the field is wireless communication and I'll check out the link. also. – mark leeds May 27 '18 at 16:47