1

Does anyone have a clue as to why -using mscohere- the coherence becomes exactly one for all frequencies if nfft is set to about 190-200. I know it's standard practice to set it to a number that is a power of 2. I tried with 1024, and all I got was a bunch of NaN. So I started with low numbers, and the coherence seem to have plausible numbers until I hit the 190 mark. I'm completely baffled. Looking forward to hearing from you.

Fede C
  • 11
  • 3
  • how many input points? –  Apr 18 '19 at 11:57
  • I'm experimenting with 120 data points – Fede C Apr 18 '19 at 12:40
  • you should have hundreds of points per bin. –  Apr 18 '19 at 12:43
  • it's funny how they don't write that in the textbooks. In other words, you're saying whatever result I get (when I get numerical results) is rubbish? – Fede C Apr 18 '19 at 12:58
  • I forgot to mention, I bootstrap the series, precisely because the sample size is very small. I suppose that doesn't change things? – Fede C Apr 18 '19 at 12:59
  • I know how to boot strap a rv of a single variable. you would need to generate correlated sequences. The are several papers by Cliff Carter on MSC and the pdf of the sample statistics is known –  Apr 18 '19 at 13:07
  • Yes, I've used moving block bootstraps, something that people advocate for dependent data, using an algorithm that basically chooses the block length on the basis of the rate of decay of the autocorrelation function. – Fede C Apr 18 '19 at 13:27
  • Do you have any idea why the coherence is so sensitive to the choice of nfft, despite having properly bootstrapped my series? – Fede C Apr 18 '19 at 14:18
  • a sample size of 1 sample per bin is meaningless. In general, divide-by-zero causes most NaN results in Matlab. Matlab uses FFTW for its DFT so it can handle not power of two sizes. mscohere() probably wasn’t tested a lot for FFT sizes greater than the data size. getting an error in a situation where the call is statistically meaningless doesn’t bother me. –  Apr 18 '19 at 14:31
  • Right. If I run 1000 bootstraps for series x and y and compute the coherence between the values of x and y at a given frequency, and then I average across the 1000 coherence values for that frequency and report that (in a graph) alongside the similarly bootstrapped quantiles, is that still meaningless? Pardon my ignorance, but does that still count as a sample of 1 per bin? I'm not being sarchastic, I genuinely don't know. – Fede C Apr 18 '19 at 15:04
  • I -perhaps wrongly- think of a frequency bin as a discrete point in time. Using time series, there's only one discrete value that corresponds to that bin. Or am I talking utter nonsense? – Fede C Apr 18 '19 at 15:06
  • like i said before, Cliff Carter papers. you average the numerator and denominator terms and then calculate the coherence from the averages –  Apr 18 '19 at 15:10

0 Answers0