jan-mathijs schoffelen j.schoffelen at PSY.GLA.AC.UK
Sun May 3 21:33:43 CEST 2009

Dear Jamie,

For me it is not exactly clear what you want to do. In an earlier  
message you referred to our paper using a permutation test to test  
for a significant difference in coherence between conditions (Maris  
et al 2007). Essentially, as described, this is a test which is  
performed within each subject allowing you to do statistical  
inference about the potential difference between two conditions. As  
such this is the type of test indepsamplesZcoh can perform, if  
properly used (see below). Yet, you describe using two subjects as an  
input. This to me sounds rather that you would like to do statistics  
across subjects (although 2 subjects of course is a rather low  
number). This is NOT something indepsamplesZcoh can do  for you. In  
general it is possible to test for a significant difference between  
two conditions across a population of subjects, but this would  
require a different approach. Rather than shuffling single  
observations across conditions PRIOR TO COMPUTING THE COHERENCE  
DIFFERENCE (sorry about the capitals but this is essential for what  
is to follow below), one would swap the sign of the Z-transformed  
coherence difference for a random subset of subjects prior to averaging.
It seems as if you computed coherence spectra between all unique  
pairs of channels (4x5)/2 and used this as an input to  
freqstatistics. Yet, for single subject statistics this does not make  
sense, because indepsamplesZcoh expects fourier-spectra in the input.  
Within the function Z-transformed coherence difference will be  
computed between all pairs of input channels (in your case this would  
be (9x10)/2 (even though the function does not know you provide it  
with the wrong input), and multiplying this number with 52 would give  
your 'magical' 2340).
So, indeed you should either format your data in a different way  
using single subject fourier spectra in two conditions as an input to  
freqstatistics, or using a different statistical test to test for  
differences across subjects.



On May 3, 2009, at 7:00 PM, Jamie Johnston wrote:

> Hi all –
> I am trying to run a monte carlo – indepsamplesZcoh – cluster on my  
> data using freqstatistics.  I input two data files into  
> freqstatistics with the cohspctrm having dimensions 2 (subjects) x  
> 10 (channels, # of coherence spectra) x 52 (frequencies).  I run  
> into a dimension mismatch in the function clusterstat.  If I run  
> any other statistic (i.e., indepsamplesT) it runs fine.  When  
> running the indepsamplesT, clusterstat receives two inputs: statobs  
> (520x1) and statrnd (520x100). These dimensions make sense to me.   
> However, when running indepsamplesZcohthese two variables have  
> dimensions 2340x1 and 2340x100, respectively.  This happens around  
> lines 104-108 in indepsamplesZcoh.m with computation of the  
> variables “chancmbsel” and “nnewsamples.”  I’m not understanding  
> what these variables do, but my guess is that I need to setup my  
> data files differently in the beginning.  My understanding of what  
> this analysis protocol does is compute the z-statistic on each  
> channel of coherence data (10 for each data file) and then find the  
> difference between the z-statistic for each channel across the data  
> files. Once this is complete it runs the permutations to determine  
> the significance.
> Please verify that what I have done is correct and any help with  
> the error I am getting would be greatly appreciated.
> Thanks,
> Jamie
> _______________
> Jamie Johnston, Ph.D.
> Assistant Professor
> Faculty of Kinesiology
> University of Calgary
> 2500 University Dr. NW
> Calgary, AB
> T2N 1N4
> Phone: +1 (403) 220-3649
> Fax: +1 (403) 284-3553
> email: johnston at
> website:
> ----------------------------------
> The aim of this list is to facilitate the discussion between users  
> of the FieldTrip toolbox, to share experiences and to discuss new  
> ideas for MEG and EEG analysis.

The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also and
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the fieldtrip mailing list