Coherence of random data

J.M. Schoffelen Jan.Schoffelen at FCDONDERS.RU.NL
Thu Feb 17 14:19:07 CET 2005

Dear Laurens,

Perhaps I can give a little try at what I think might cause the differences:

>When I pass random data in FieldTrip and calculate coherence I get some
>problematic results. I shall try to explain what I did. I used the trial
>definition of a real experiment and just replaced the segmented data in the
>trial structure with this script (and checked with a plot if the data was
>really random):
>for trial=1:210
>        data.trial{trial} = randn(1001,24)'; %pass random data for 24
>        randn('state',sum(100*clock)); %reset randon number generator state
>The data structure passed was:
>data =
>      trial: {1x210 cell}
>      label: {24x1 cell}
>       time: {1x210 cell}
>    fsample: 2000
>        cfg: [1x1 struct]
>Then I calculated spectra with the following parameters:
>freqcfg =
>        output: 'powandcsd'
>        method: 'mtmfft'
>        foilim: [6 100]
>     tapsmofrq: 4
>    channelcmb: {'all'  'FDI'}
>           pad: 'maxperlen'
>       channel: 'all'

Seeing these configurations, I conclude, that you have 210 trials with a
length of 1001 samples per trial, which is equivalent to half a second + one
sample. Right?
So I would guess that when you apply a multitaper-fft on these segments, you
would obtain 3 tapers per trial. Multitapering 'multiplies' the degrees of
freedom in your estimate, so you end up with 3 times 210 independent
estimates of your cross-spectral densities.

>And at last coherence with no further configuration. Confidence limit of
>coherence = 0.0218. Nevertheless I get coherences with a mean of about 0.05
>in the whole frequency range I calculated (6-100) but with peaks to even
>0.16 (!).
>Actually I did this because I got much higher coherences with FieldTrip
>with Neurospec (, David Halliday), with exactly the same
>data before frequency and coherence analysis was started.

I assume that you obtained your confidence-interval for the coherence by
applying the formula (6.6) in the Halliday1995-paper which is referred to on
this neurospec-website. However, and here is it that I think something might
have gone wrong, this confidence-limit under the null-hypothesis of no
coherence at all, applies to the coherence-squared (the ratio between the
squared-crossspectrum and the product of the powers). Coherence as it is
outputted by the freqdescriptives-function is obtained by dividing the
cross-spectrum (no square!) by the square-root of the product of the powers!
So, in the first place, if you would want to directly compare the
coherence-values outputted by the two methods (fieldtrip vs. neurospec), you
should be aware of this potential difference.
The things mentioned above, mean that you would have to take the square-root
of this formula 6.6: 1-(0.01).^(1./L-1) (I see that you used an alpha of
1%), in which L represents the number of independent estimates, and in the
case of multitapering that means the total number of tapers applied (in your
case 630?)!
Does this change the picture a bit? (Some additional information might be
found in: Sampling properties of the spectrum and coherency of sequences of
action potentials by Jarvis & Mitra: Neural Computation 13,717-49(2001)
Don't pay too much attention on the actionpotential parts).



PS: take care: even with a higher threshold you would expect 1% of your
coherence-values to exceed the threshold!

More information about the fieldtrip mailing list