# Optimal segment length for coherence estimation

I have a question about the computation of coherence between two signals with Welch's method.
The two signals are relatively short (e.g. 256 samples) and I would like as correct an estimate of shared frequencies between the signals as possible.
I am aware that I need to average over more than one segment of data for meaningful results and that overlapping segments will improve accuracy. Computational effort in the computation is not an issue, so I am using $noverlap = nseg-1$. Acquiring more samples is not possible.

The coherence is computed as $C_{xy} = \frac{|G_{xy}|^2}{G_{xx} G_{yy}}$ where $G_{xy}$ is the Cross-Spectral Density and $G_{xx}$ and $G_{yy}$ are the Power Spectral Densities of both signals, respectively.

My question is:
What is the optimal length of segments?
nseg=ndata (no averaging) leads to $C_{xy} = 1$ whereas a too small value of nseg leads to insufficient frequency resolution.
Is there any value for nseg for which an optimal compromise between sufficient averaging and frequency resolution can be found?

Both theoretical and best-practice suggestions would be appreciated!

There is good news and bad news. You are actually showing magnitude squared coherence(MSC). There is a very complete treatment of MSC, including closed form equations for the sample MSC as a function of independent samples. There is also a discussion on overlap in:

    G. C. Carter, “Coherence and time delay estimation,”
Proceedings of the IEEE, vol. 75, no. 2, pp. 236–255, 1987


The bad news is in the plot, which is the sample pdf for MSC where the true MSC is .3, in a single bin where the legend denotes the number of independent terms. If you want 256 frequency bins, you really need around $256^2$ data points.

You might want to look up the paper and note any recent citations where there is some scheme to reduce the amount of data you need, but 256 points is not anywhere near enough.

• Thanks for the answer and the link to the paper. It seems to state the exact problem I was describing in the introduction. However, if I understand correctly the equations given are valid for MSC estimation without overlap. This is actually done in a paper by Bortel and Sovka "Approximation of statistical distribution of magnitude squared coherence estimated with segment overlapping". A follow-up question: Does it help to increase the sampling frequency? This would increase the number of used samples without requiring to collect data over longer time periods. – FirstSecondThird Apr 17 '18 at 6:17
• If it did, I doubt by X 256. – user28715 Apr 17 '18 at 10:23
• invention is often the child of desperation, there is “boot strapping” – user28715 Apr 17 '18 at 10:46