[FSL] [TitleIndex] [WordIndex


USING randomise

A typical simple call to randomise uses the following syntax:

randomise -i <4D_input_data> -o <output_rootname> -d design.mat -t design.con -m <mask_image> -n 500 -D -T

design.mat and design.con are text files containing the design matrix and list of contrasts required; they follow the same format as generated by FEAT (see below for examples). The -n 500 option tells randomise to generate 500 permutations of the data when building up the null distribution to test against. The -D option tells randomise to demean the data before continuing - this is necessary if you are not modelling the mean in the design matrix. The -T option tells randomise that the test statistic that you wish to use is TFCE (threshold-free cluster enhancement - see below for more on this).

When using the demeaning option, -D, randomise will also demean the EVs in the design matrix, providing a warning if they initially had non-zero mean (and as long as this doesn't cause the matrix/contrasts to become rank deficient then this warning can be ignored).

There are two programs that make it easy to create the design matrix, contrast and exchangeability-block files design.mat / design.con / design.grp . The first is the Glm GUI which allows the specification of designs in the same way as in FEAT, and the second is a simple script to allow you to easily generate design files for the two-group unpaired t-test case, called design_ttest2.

randomise has the following thresholding/output options:

These filename extensions are summarized in table below.

Voxel-wise

TFCE

Cluster-wise

Extent

Mass

Raw test statistic

_tstat
_fstat

_tfce_tstat
_tfce_fstat

n/a

n/a

1 - Uncorrected P

_vox_p_tstat
_vox_p_fstat

_tfce_p_tstat
_tfce_p_fstat

n/a

n/a

1 - FWE-Corrected P

_vox_corrp_tstat
_vox_corrp_fstat

_tfce_corrp_tstat
_tfce_corrp_fstat

_clustere_corrp_tstat
_clustere_corrp_fstat

_clusterm_corrp_tstat_
_clusterm_corrp_tstat_

"FWE-corrected" means that the family-wise error rate is controlled. If only FWE-corrected P-values less than 0.05 are accepted, the chance of one more false positives occurring over space space is no more than 5%. Equivalently, one has 95% confidence of no false positives in the image.

Note that these output images are 1-P images, where a value of 1 is therefore most significant (arranged this way to make display and thresholding convenient). Thus to "threshold at p<0.01", threshold the output images at 0.99 etc.

If your design is simply all 1s (for example, a single group of subjects) then randomise needs to work in a different way. Normally it generates random samples by randomly permuting the rows of the design; however in this case it does so by randomly inverting the sign of the 1s. In this case, then, instead of specifying design and contrast matrices on the command line, use the -1 option.

You can potentially improve the estimation of the variance that feeds into the final "t" statistic image by using the variance smoothing option -v <std> where you need to specify the spatial extent of the smoothing in mm.

Parallelising Randomise

If you are have an SGE-capable system then a randomise job can be split in parallel with randomise_parallel which takes the same input options as the standard randomise binary and then calculates and batches an optimal number of randomise sub-tasks. The parallelisation has two stages - firstly the randomise sub-jobs are run, and then the sub-job results are combined in the final output.

Examples

One-Sample T-test

To perform a nonparametric 1-sample t-test (e.g., on COPEs created by FEAT FMRI analysis), create a 4D image of all of the images. There should be no repeated measures, i.e., there should only be one image per subject. Because this is a single group simple design you don't need a design matrix or contrasts. Just use:
randomise -i OneSamp4D -o OneSampT -1 -T
Note you do not need the -D option (as the mean is in the model), and omit the -n option, so that 5000 permutations will be performed.

If you have fewer than 20 subjects (approx. 20 DF), then you will usually see an increase in power by using variance smoothing, as in
randomise -i OneSamp4D -o OneSampT -1 -v 5 -T
which does a 5mm HWHM variance smoothing.

Note also that randomise will automatically select one-sample mode for appropriate design/contrast combinations.

Two-Sample Unpaired T-test

To perform a nonparametric 2-sample t-test, create 4D image of all of the images, with the subjects in the right order! Create appropriate design.mat and design.con files.

Once you have your design files run:
randomise -i TwoSamp4D -o TwoSampT -d design.mat -t design.con -m mask -T 

Two-Sample Unpaired T-test with nuisance variables

To perform a nonparametric 2-sample t-test in the presence of nuisance variables, create a 4D image of all of the images. Create appropriate design.mat and design.con files, where your design matrix has additional nuisance variables that are (appropriately) ignored by your contrast.

Once you have your design files the call is as before:
randomise -i TwoSamp4D -o TwoSampT -d design.mat -t design.con -m mask -T

Repeated measures ANOVA

Following the ANOVA: 1-factor 4-levels (Repeated Measures) example from the FEAT manual, assume we have 2 subjects with 1 factor at 4 levels. We therefore have eight input images and we want to test if there is any difference over the 4 levels of the factor. The design matrix looks like

1 0 1 0 0
1 0 0 1 0
1 0 0 0 1
1 0 0 0 0
0 1 1 0 0
0 1 0 1 0
0 1 0 0 1
0 1 0 0 0

where the first two columns model subject means and the 3rd through 5th column model the categorical effect (Note the different arrangement of rows relative to the FEAT example). Three t-contrasts for the categorical effect

0 0 1 0 0
0 0 0 1 0
0 0 0 0 1

are selected together into a single F-contrast

1 1 1

Modify the exchangeability-block information in design.grp to match

1
1
1
1
2
2
2
2

This will ensure that permutations will only occur within subject, respecting the repeated measures structure of the data. The number of permutations can be computed for each group, and then multiplied together to find the total number of permutations. We use the ANOVA computation for 4 levels, and hence (1+1+1+1)!/1!/1!/1!/1! = 24 possible permutations for one subject, and hence 24 × 24 = 576 total permutations. The call is then similar to the above examples:
randomise -i TwoSamp4D -o TwoSampT -d design.mat -t design.con -f design.fts -m mask -e design.grp -T

Getting Cluster and Peak Information from Randomise Output

Assuming that the best image to get the clusters and peak information from is the raw tstat image:

begin by masking this with the significant voxels from corrp:

fslmaths grot_tfce_corrp_tstat1 -thr 0.95 -bin -mul grot_tstat1 grot_thresh_tstat1

Now run cluster to extract the clusters and local maxima in several different outputs:

cluster --in=grot_thresh_tstat1 --thresh=0.0001 --oindex=grot_cluster_index --olmax=grot_lmax.txt --osize=grot_cluster_size

If the data is already in standard space (MNI152) and co-ordinate reporting is wanted in MNI (mm) values, add --mm to the end of the command.

If clusters need to be forced to be more highly split, the --thresh value can be raised to an appropriate level. Because the input image was already masked by the corrp image, regardless of the thresh value used in the cluster command, only significant voxels will ever be reported.


Associated Tools

Lesion Masking

For many clinical studies there are pathologies present (we are calling them "lesions" here, but they could be anything) and it is desirable to exclude them from the analysis, since they are usually highly variable across patients. In order to make this task easier in randomise there is a script called setup_masks. This takes a set of user-defined masks (normally drawn by hand) and creates a suitable set of files that can be used in randomise, including modified design matrices and contrasts to include the mask-based EVs.

Usage of the script is:

setup_masks <input matrix> <input contrast> <output basename> <mask1> <mask2> ...

The list of mask images (<mask1> <mask2> ...) must be from subjects in the same order as used in the design matrix

New versions of both the design matrix and contrasts are created (starting with the specified output basename). In addition, a set of images is created, suitable as voxelwise regressors for randomise, and a list file tailored for randomise.

The final output of the script is an example call to randomise (printed to the screen) that shows exactly how to use the output files in a call to randomise. Other options (as would have been used without the voxelwise regressors) can then be added at the end of the randomise command to easily form a complete randomise call.


CategoryRandomise


2012-09-05 11:30