Hello Johan,
Sign-flipping with the --permuteBlocks option currently does not work in the publicly released version of randomise, however it is in our internal build and will be released with the next patch.
Kind Regards
Matthew
> Dear Anderson,
>
> See the attach for a zip with all the files in it. I also gave the
> design.fts file I used, as well as a 4D_files.txt which tells what the
> contents of the 4D file are. (the design seems different than
> previously written, but is actually the same since in the the 4D now
> each time bin is grouped, instead of each subject)
>
> I think that if permuteBlocks would work with the -1 option so that
> the scans within each block would be sign-flipped for each
> permutation, and the # of permutations would depend on the # of
> blocks, it would work out...
>
> Thanks a lot for looking into it, kind regards,
> Johan
>
>
>
>
> On Wed, Jan 30, 2013 at 6:33 PM, Anderson M. Winkler
> <[log in to unmask]> wrote:
>> Dear Johan,
>>
>> Could you please send your design.mat, design.con and design.grp files? It
>> *might* be possible that the current version of randomise can't yet deal
>> with sign-flippings in the very particular design you have when the
>> exchangeability groups are set, but let's have a closer look.
>>
>> Thanks!
>>
>> All the best,
>>
>> Anderson
>>
>>
>>
>> 2013/1/29 Johan <[log in to unmask]>
>>>
>>> Dear Andersson,
>>>
>>> As a follow up to the discussion some weeks ago regarding an F-test on
>>> a FIR basis set at 2nd level with randomise (I have only 1 group), and
>>> have still several questions about the # of permutations that I get
>>> when I try what you suggested.
>>>
>>> I did as you suggested (the workaround of setting exchangability
>>> blocks per time bin, so that permutations happen across subject), and
>>> then found that randomise gave me only 1 permutation for my one f
>>> contrast and each t contrasts when I check for the # of permutations.
>>>
>>> randomise -i 4D -o out/ -d design.mat -f design.con -t design.fts -e
>>> design.grp -T -v 5 -m mask -q
>>>
>>> After that (to test the sign-flipping), I tried randomise with a
>>> different 4D.nii.gz file (just the fist time bin) and a one sample
>>> design, and it told me that it detected a one-sample design and needed
>>> 4096 permutations (which sounds correct)...
>>>
>>> Then I saw the -1 option, and tried:
>>>
>>> randomise -i 4D -o out/ -d design.mat -f design.con -t design.fts -e
>>> design.grp -T -v 5 -m mask -1 -q
>>>
>>> Now it says that randomise is going to sign-flip, and that it needs
>>> 1.32923 E+36 permutations, which is 4096^10. It sounds better, but it
>>> is still not the same as SnPM (which was also 4096 (divided by 2)). I
>>> think SnPM flips the sign of every bin of a subject simultaneously,
>>> for each of its permutations across subjects. Randomise flips only one
>>> bin of a subject and leaves the other bins alone per permutation. I do
>>> not know if this matters a great deal for my results. I hope I am not
>>> totally confusing here :-)
>>>
>>> It seems that, to allow signflip testing for any other design than a
>>> one-sample t-test, you need the -1 option. Also, with the -1 option,
>>> the exchangability blocks do not matter (as the # of permutations that
>>> I get is the same as if no exchangability blocks are defined). I also
>>> tried the --permuteBlocks option, also in combination with the -1
>>> option, but I didn't get the right # of permutations in that way
>>> either.
>>>
>>> So I am not sure how to proceed... could I do the workaround option
>>> with the -1 option (and should I not worry about the # of
>>> permitations), or should I do the one sample T-tests for each time
>>> bin, and then process those results as you suggested as my third
>>> option?
>>>
>>> I hope I have not made the story too long... and thanks again in advance!
>>>
>>> Johan
>>>
>>>
>>>
>>>
>>>
>>> On Tue, Jan 15, 2013 at 3:14 PM, Johan <[log in to unmask]> wrote:
>>>> Dear Andersson, thanks again for your answers. I will try to set
>>>> eschangability blocks per time-bin and let you know how it works out.
>>>>
>>>> Kind regards,
>>>> Johan
>>>>
>>>> On Mon, Jan 14, 2013 at 4:59 PM, Anderson M. Winkler
>>>> <[log in to unmask]> wrote:
>>>>> Dear Johan,
>>>>>
>>>>>
>>>>> 2013/1/14 Johan <[log in to unmask]>
>>>>>>
>>>>>> Dear Anderson, thank you very much for your answers :-) I have some
>>>>>> follow-up question though:
>>>>>>
>>>>>> Indeed I have only a single group. If I understand correctly, the SnPM
>>>>>> plugin uses sign-flippings to assess the H0 that the inputs are
>>>>>> (about) equal to 0 (so assigning +1 and -1 wouldn't make a difference
>>>>>> under H0), and doesn't do anything to the design matrix. Would the
>>>>>> workaround with randomise you suggested also do some sort of
>>>>>> sign-flipping (or rather shuffling of the design matrix)?
>>>>>
>>>>>
>>>>> I haven't been using SnPM for a while but if I remember correctly, both
>>>>> randomise and SnPM do the same in this regard, although interacting
>>>>> differently with the user. For both, if there is a single group of
>>>>> subjects,
>>>>> and the contrast is to test whether a regressor is zero for a column of
>>>>> ones, then there will be sign-flippings instead of permutations. The
>>>>> reason
>>>>> is that permuting the design matrix (or the relevant columns, or the
>>>>> data)
>>>>> is ineffective: there is no net effect of shuffling in these cases, and
>>>>> then
>>>>> no useful empirical distribution could be built. The sign-flippings
>>>>> make it
>>>>> possible and come with a slight change of assumptions, but it's still a
>>>>> non-parametric test and so, with all the benefits over parametric
>>>>> counterparts.
>>>>>
>>>>>
>>>>>>
>>>>>> The
>>>>>> sign-flipping in the SnPM plugin says that there are 2^(12-1) = 2048
>>>>>> permutations of assinging +1 and -1 to 12 scans. Randomise will maybe
>>>>>> say that there are 2048 permutations for each bin, so a total of
>>>>>> 2048^10 permutations... so I am not totally sure about this, but I
>>>>>> will try this in any case.
>>>>>
>>>>>
>>>>> If the design is the same, both SnPM and randomise should give the same
>>>>> total number of possible sign-flippings.
>>>>>
>>>>>
>>>>>> Would the solution of doing 10 separate 1-sample T-tests with
>>>>>> randomise be something like a Tripled Two-Group Difference ("Tripled"
>>>>>> T-Test) such as is outlined in the FEAT user guide?
>>>>>
>>>>>
>>>>> No no, not the same...
>>>>>
>>>>>
>>>>>>
>>>>>> As an additional workaround, I could also use fslmaths to TFCE my
>>>>>> con(cope) images, then unput those in the SnPM tool of SPM.
>>>>>
>>>>>
>>>>> Hmm... you could, but it would be an entirely different test, and a
>>>>> strange
>>>>> one... TFCE is a positive quantity, so test whether it's different than
>>>>> zero
>>>>> wouldn't make much sense I think. It's more informative to test whether
>>>>> the
>>>>> con/cope images are different than zero, and then use TFCE as the
>>>>> statistic
>>>>> for the inference, just as randomise does.
>>>>
>>>>
>>>>>
>>>>> All the best!
>>>>>
>>>>> Anderson
>>>>>
>>>>>
>>>>>
>>>>> On Fri, Jan 11, 2013 at 6:41 PM, Anderson M. Winkler
>>>>> <[log in to unmask]> wrote:
>>>>>> Dear Johan,
>>>>>>
>>>>>> Replying your first email: this would be correct in principle, and you
>>>>>> only
>>>>>> would need to add the --permuteBlocks option. Ignoring this option
>>>>>> would
>>>>>> cause the permutations to happen within subject and so, across the
>>>>>> bins,
>>>>>> which I understand is exactly what you don't want.
>>>>>>
>>>>>> However, it seems you have just a single group, right? In this case,
>>>>>> the
>>>>>> permutations will never change the design matrix. These cases are
>>>>>> normally
>>>>>> dealt with by replacing the permutations with sign-flippings. However,
>>>>>> the
>>>>>> --permuteBlocks is a beta-option and I'm not sure whether block
>>>>>> sign-flipping has already been implemented for this case.
>>>>>>
>>>>>> As a workaround, and to ensure that the shufflings happen within bin,
>>>>>> you
>>>>>> can keep the same design matrix and redefine your design.grp to use
>>>>>> one
>>>>>> group per bin (so, 10 groups rather than 12) and then don't use the
>>>>>> --permuteBlocks option (which is what you suggest in your second
>>>>>> email).
>>>>>>
>>>>>> Yet another possibility is to split the 120 volumes into 10 sets (one
>>>>>> for
>>>>>> each bin) of 12 subjects each, and run a 1-sample t-test 10 times
>>>>>> separately
>>>>>> in randomise (perhaps using the same seed for each run), one for each
>>>>>> bin.
>>>>>> You'll only lose the ability to do an F-test directly (there is a
>>>>>> workaround
>>>>>> for this too, but it's not as trivial).
>>>>>>
>>>>>> Hope this helps!
>>>>>>
>>>>>> All the best,
>>>>>>
>>>>>> Anderson
>>>>>>
>>>>>>
>>>>>> Am Freitag, 11. Januar 2013 schrieb Johan :
>>>>>>
>>>>>>> Dear FSL list, a few days ago I sent a mail (see below) on how to do
>>>>>>> a
>>>>>>> within-subject one-way ANOVA on 12 subjects (each with 10 "time bin"
>>>>>>> contrast images) with randomise.
>>>>>>>
>>>>>>> Basically, I would like to check if there's an effect in any of the
>>>>>>> contrast images (i.e., if any of them is > or < than 0), much like in
>>>>>>> what is described in section 30.5 of the SPM manual (FIR basis set),
>>>>>>> or what the snpm_pi_ANOVAwithinS plugin does for SnPM.
>>>>>>>
>>>>>>> My main question is if this is at all possible with randomise, and
>>>>>>> also how I should do the exchangability blocks in this case: group
>>>>>>> each subject, or group each time bin (I think the latter).
>>>>>>>
>>>>>>> Many thanks in advance and kind regards,
>>>>>>> Johan
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Jan 9, 2013 at 2:07 PM, Johan <[log in to unmask]>
>>>>>>> wrote:
>>>>>>>> Dear FSL list,
>>>>>>>>
>>>>>>>> I have a question about how to go about doing a 2nd level FIR
>>>>>>>> analysis
>>>>>>>> with Randomise and TCFE:
>>>>>>>>
>>>>>>>> Basically I am interested just localizing one specific
>>>>>>>> (event-related)
>>>>>>>> activity in the brain in a group of 12 subjects. I use a FIR basis
>>>>>>>> set
>>>>>>>> of 10 time bins at single-subject level.
>>>>>>>>
>>>>>>>> I did all the first-level analysis in SPM, and have made contrast
>>>>>>>> images, one for each of the 10 bins, so I have 120 images for
>>>>>>>> Randomise that I put into 1 4D file.
>>>>>>>>
>>>>>>>> I then made a design matrix with Glm.. The design looks like this
>>>>>>>> (the
>>>>>>>> contents of 4D file to the left):
>>>>>>>> Sub1Bin1 1 0 0 ... etc, until 10 rows
>>>>>>>> Sub1Bin2 0 1 0 ...
>>>>>>>> Sub1Bin3 0 0 1 ...
>>>>>>>> Sub1Bin4 0 0 0 ...
>>>>>>>> Sub1Bin5 0 0 0 ...
>>>>>>>> Sub1Bin6 0 0 0 ...
>>>>>>>> Sub1Bin7 0 0 0 ...
>>>>>>>> Sub1Bin8 0 0 0 ...
>>>>>>>> Sub1Bin9 0 0 0 ...
>>>>>>>> Sub1Bin10 0 0 0 ...
>>>>>>>> Sub2Bin1 1 0 0 ...
>>>>>>>> Sub2Bin2 0 1 0 ...
>>>>>>>> ...
>>>>>>>> ... etc, until Sub12Bin10.
>>>>>>>>
>>>>>>>> I also make 1 T-contrast for every bin and 1 F-contrast over all
>>>>>>>> bins
>>>>>>>> (and save it).
>>>>>>>>
>>>>>>>> Then I adjust the design.grp file (to adjust the exchangability
>>>>>>>> blocks) so that each subject has its own ID (so that Randomise will
>>>>>>>> swap subjects with each other and not time bins within subjects).
>>>>>>>>
>>>>>>>> Later on, i'll do the cluster and the atlasquiery commands with the
>>>>>>>> _tfce_corrp_fstat images to try to search for the significant
>>>>>>>> clusters.
>>>>>>>>
>>>>>>>> Would this be the way to go about it (or am I missing something
>>>>>>>> essential), or would you recommend a better way to go about it?
>>>>>>>>
>>>>>>>> Thanks for your time and kind regards,
>>>>>>>> Johan
>>>>>>>>
>>>>>>>> Johan van der Meer
>>>>>>>> CANLAB, Dept. of Neurology
>>>>>>>> Otto v. Guericke University
>>>>>>>> Leipziger Str. 44
>>>>>>>> D-39120 Magdeburg
>>>>>>>> Tel: +49 391 61 17 536
>>>>>>>> Fax: +49 391 61 17 531
>>>>>
>>
>>
> <designfiles.zip>
|