Mensen / ept_TFCE-matlab

Advanced EEG Statistics
27 stars 9 forks source link

tfce on uni-dimensional data #21

Open normanF opened 6 years ago

normanF commented 6 years ago

Dear Armand,

is it possible to use your tb (or a function of it) to get tfce values for a two-condition comparison only along the time (or frequency) dimension?

Best, Norman

Mensen commented 6 years ago

Yes, this is fairly easy; although not-at-all intuitive...

Running the ept_TFCE scripts from the command line...

You would repmat your 1 temporal dimension into 2 dimensions (copy of the 1st)... then in your temporal-only case, set the flag_ft = true; so it doesn't look for a channel locations file.

You're output will also have 2 dimensions but you'll notice that the p-values etc are identical. While you might think that doing this would double the cluster-sizes found at all thresholds and this is somehow "not-okay"... it also doubles them for all permutations run and so just adjusts the scale of the TFCE values (and the empirical distribution)... but not at all the p-values.

Good luck!

normanF commented 6 years ago

Nice hack, works perfectly. I guess ept_TFCE will then create another dimension and removes it again after TFCE transformation, right? At this place in the code, an additional parameter (deltaT) is handed over to the tfce transformer function. I get that this is the maximal difference between the conditions, which is divided by 50. I always wondered what this '50' is? cheers

Mensen commented 6 years ago

The threshold-free part is indicative of the calculation of a "supporting area" for each data point (e.g. individual channel-sample). In theory this can be calculated directly like an area under the curve (not quite the same as supporting area but close).

However, in practice this is actually calculated through approximation by having multiple progressive thresholds set from 0 to the maximum statistical point in small increments. So the smaller these increments, the more accurate to the true approximation of the supporting area... but the longer the calculation would take. "50" distinct increments is what the number means... this seams a little arbitrary but in empirical calculations from different signal types, this level of approximation was found to essentially never change a p-value before the 10^-6 decimal point... and given the random selection of permutations changes the p-values ahead of this point (again though depending on the number of permutations selected), then this "50" is a very safe selection that still allows the computation to be fast.

normanF commented 6 years ago

Awesome, thanks for this explanation. Makes totally sense!