hi, i have done a time-frequency analysis on magnetencephalographic data under different conditions. the matrices for each condition are three dimensional: frequency x time x subject. to identify time-frequency "areas" of interest i would first calculate a simple t-test for each time frequency point. this is straightforward and for each comparison i have a frequency x time representation of t-values. using an alpha threshold "candidate" time-frequency regions can be identified. I will just call them clusters for simplicity. the t-values within each cluster are added (T). to find out which clusters can be considered significant i would like to implement a randomization test to generate a distribution of Tmax with which I could compare my original Ts with. However I'm stuck at the lowest possible level ... well the second lowest level (the t.test is easy) :-) starting from the time x frequency representation of t-values, masked so that all values with p's below some magical number are set to 0: is there some ready-made function in R that can help me identifying the clusters (i.e. returning the array-indexes)? the general idea outlined here is implemented under Matlab in the Fieldtrip toolbox. however, the relevant function relies on functions from the Image Processing toolbox (which i don't have). furthermore i would really like to outsource statistics from Matlab to R whenever I can. Thanks ins advance for any help, nathan