NISOx-BDI / SwE-toolbox

SwE toolbox
GNU General Public License v2.0
16 stars 7 forks source link

Add TFCE as inference option #15

Closed nicholst closed 6 years ago

nicholst commented 6 years ago

Request from Mary Heitzeg's group at the University of Michigan

TomMaullin commented 6 years ago

Hi @nicholst ,

I have been looking into how this could be done and I was wondering if the following is what you had in mind;

In the SwE GUI would be a TFCE option. This would be calculated by;

The only additional choices the user should have is the variable dh for computing the TFCE integral.

The resultant output of this process should then be the maps:

As well as the usual parametric maps.

The display should then only have columns for:

Is this close to what you had in mind? Or should this be done using a different permutation method from wild bootstrap?

nicholst commented 6 years ago

Hi @TomMaullin ,

Right! I had forgotten about MatlabTFCE and amazed at the concision of that function https://github.com/markallenthornton/MatlabTFCE/blob/master/matlab_tfce_transform.m ... we only need that one function!

You've really got your head wrapped around it! Just a few things to note:

  1. The TFCE transform is constructed for z-score like-quantities. That means that F-test values will need to be transformed to Z's via a probability integral transform... look it up; it basically a way to transform any r.v. via p-values, like

    d1=3;d2=100;
    SomeFs=frnd(d1,d2,1000,1);
    SomeSz=-norminv(fcdf(SomeFs,d1,d2,'upper'));

    where we've carefully used the complementary (upper tail) CDF to avoid extreme F-values creating near CDF values that underflow to 1.0.

  2. "TFCE" is the statistic name/type, so the naming will be: swe_TFCE_... otherwise your naming is perfect.

Otherwise, you've nailed it! Once we do it here, it would be great to add it to SnPM, as per here: https://github.com/SnPM-toolbox/SnPM-devel/issues/54

TomMaullin commented 6 years ago

Ah great! Ah right of course yes! The only two things I am still unsure on are as follows:

nicholst commented 6 years ago

Did our meeting sort all these out? As TFCE will be considerably slower than cluster inference, I think it does need to be a 'switch' somewhere. "TFCE inference: Off" vs "TFCE inference: On" with help explaining

Enabling TFCE inference will replace cluster inference with Threshold-Free Cluster Enhancement. A cluster-forming threshold can no longer be specified in the results, and only a FWE-corrected P-value can be used to set the threshold.

Is this good? Or maybe we want to have cluster inference recorded, and if TFCE was computed, the user can choose at results time to show TFCE or cluster inference???

TomMaullin commented 6 years ago

Yes, I guess the user could select between TFCE and cluster inside the WB. What do you think of this suggestion for the updated GUI WB menu option. I.e.

Non-Parametric Wild Bootstrap
-- Yes
---- Small sample adjustments for the resampling
---- Number of bootstraps
---- Type of SwE
---- Statistic Type
------ T/F
-------- Contrast
---- Inference Method (choose one of the three)
------ Voxelwise
------ Clusterwise
-------- Cluster-forming threshold
------ TFCE
-------- Options: T/F
-- No
nicholst commented 6 years ago

Yes, this looks good.

As for options, we could include the H and E values... some people want to mess with those.

TomMaullin commented 6 years ago

Ah right, yes! Should dh also be an input?

TomMaullin commented 6 years ago

Questions/Updates

Hi @nicholst ,

This is just a quick further questions/updates post. Currently, the code has been updated to compute TFCE uncorrected and FWE-corrected P-values for T statistics (and almost for F statistics also) for volumetric input. Below is the stages I plan on implementing the TFCE in (I will tick stages off as I complete them):

I did have the following questions regarding the TFCE update, however:

nicholst commented 6 years ago

Quick answers:

Surface would be great, but I didn't think we had that functionality at all (e.g. for clusters); I'd put it at the bottom of the priority list (do it last). Yes, I think making an equivalent Z the basis of all TFCE makes sense. You need to get the F DF from the test... or am I missing something?

TomMaullin commented 6 years ago

Ah okay, sorry yes I should have been clearer - I thought I had best double check - should I use the spatially varying df or the nominal df?

TomMaullin commented 6 years ago

This issue has now been addressed by PR #48