Group FEAT lab

From NITP Summer Course Wiki

Jump to: navigation, search

Contents

Group level analysis with FEAT

Adapted from: Group FEAT practical from FSL

Multi-level FEAT Tutorial

This tutorial leads you through two examples of higher-level group analysis in FEAT.

Paired t test

We have a group of 6 subjects scanned under two different conditions, A (left hand motor function) and B (right hand). Is there a significant A-B paired difference generalisable to the population from which the subjects are drawn? We want the A-B paired mean difference within a mixed effects model, taking into account the within-subject fixed effects variances and the between-subject random effect variance. This is done as a two-level analysis:

  • Level 1: Single-session analyses; there are [6 subjects] * [2 sessions] = 12 first-level FEAT analyses. These have already been done for you.
  • Level 2: Between-subject analysis; we input the COPEs from Level 1 (there are 5 contrasts at Level 1 and hence 5 separate second-level analyses), and estimate the paired difference mean.

Note that as well as the COPEs, FEAT passes the variance of these COPEs ("varcopes"), and even the uncertainty in the variance of these COPEs ("tdofs" - degrees-of-freedom), between the different levels. The first level analyses are held in 6 different directories in: /users/psych254/FSL/fsl_course_data/fmri/ptt , one for each subject. The subject directories are ac at cm df dn eg. Within these are the first-level FEAT directories, which have already been run for you.

Each first-level analysis contained 5 contrasts ("index", "sequential", etc.). Thus there are 5 copes in the stats subdirectory of each first-level .feat directory. The higher-level analysis will be carried out independently on these contrasts, i.e. a second-level analysis of all subjects' first-level "index" contrasts, a separate second-level analysis of all first-level "sequential" contrasts, etc. Each of these second-level analyses will form a separate cope??.feat directory inside a newly-created .gfeat directory.

To make loading files more straightforward, we’ll launch FEAT from the terminal in the folder where all of the data we will use for this exercise is located. This will make choosing the data faster in the GUI because we won’t need to navigate the file system as much.

In the black Terminal window that launches when you click the Launch NITP Environment icon, type:

  • cd ~/FSL/fsl_course_data/fmri/ptt
  • Type Feat_gui &
  • Change First-level analysis to Higher-level analysis
  • Change the Number of analyses to 12 (6 subjects * 2 conditions)
  • Press Select FEAT directories. Now, you need to fill the first level FEAT directories in a sensible order. You could either put them in order:


.../ac/ac_left.feat .../ac/ac_right.feat .../at/at_left.feat (etc.)
 or you could enter all the "lefts" first and then all the "rights": 
 .../ac/ac_left.feat .../at/at_left.feat .... .../ac/ac_right.feat (etc.)

  • We recommend the latter, because this matches the example paired t-test in the FEAT manual, and also matches the way the paired t-test is setup for you if you use the "model setup wizard" (explained below).
  • Note that you can often avoid having to tediously hand-select each of these first-level FEAT directories separately, using the Paste button. If you press this, a new free-text window comes up, within which you can paste text (in this case the list of first-level FEAT directories) which you can copy, e.g. from a list in a terminal. Press Clear to clear the text window. Then in your terminal, inside the ptt directory, type 


echo `pwd`/??/??_left.feat `pwd`/??/??_right.feat
 This gives you a complete listing of the full pathnames of the FEAT directories in the right order. (The `pwd` part tells the shell to replace what's within the quotes with the result of running the command - in this case, filling out the full pathname of the current directory. The ? characters are expanded by the shell to fit any single character, in alphabetical order, hence all the "left" FEAT directories are listed first, and then all the "right".) You can now highlight this list with the mouse, and paste it into the FEAT paste window with the middle mouse button.

  • When this is done, set the Output directory to:

fsl_course_data/ptt/ptt_ols.gfeat

  • Go to the Stats tab and select the Mixed Effects: Simple OLS option. Normally, we recommend that you use one of the more accurate FLAME options, for the reasons outlined in the lecture. However, in the interest of speed, in this practical we choose the faster OLS option.
  • With this design you can use the Model setup wizard, which provides an easy way of setting up a few simple designs. Select two groups, paired and press Process. You will now see the design matrix that has been created for you. To understand how this is controlled in detail, open the Full model setup.
  • Note that the Inputs (1-12) must correspond to the order you entered the first-level FEAT directories. Also note that the first column (labeled Group) corresponds to groupings of inputs that will share the same random effects (RE) variance in this level of the model. Here, we let all subjects have the same RE variance (i.e. the Group column should be left as all 1s)
  • There are 7 EVs:
  • EV 1 models the A-B (left-right) paired difference
  • EVs 2-7 are confounds which model out each subject's mean (this is what makes the design a paired t test)
  • Click on the Contrasts & F-tests tab. There are two contrasts setup for you by the wizard. EVs 2-7 are confounds of no interest and so do not appear in the contrasts. Hence, the contrasts only involve EV1. Change the Titles to read:
  • left > right
  • right > left
  • Press Done.
  • The default Post-stats are fine. So you are now ready to run the analysis. Press Go, and wait for the results - this second-level analysis should take about 5 minutes. The first FEAT Watcher that appears monitors the overall progress and links to a registration summary FEAT report webpage. Note that the model is fitted separately to each COPE passed up from Level 1 (in this dataset there are 5 Level 1 COPEs). Subsequently, FEAT Watchers are launched (and separate higher-level FEAT report webpages generated) for each of these Level 1 COPEs.
  • Higher-level FEAT runs produce .gfeat directories. The top-level web report provides links to the previous level reports, a registration summary page (have a look at this, you may later need to reload the page if you view it before it's completed) and to the separate higher-level reports. LOOK AT YOUR DATA - in particular it is always important to look at the registration summary report page very carefully, to check that all lower-level registrations succeeded. (If any of the lower-level FEATs look like the registration has failed badly, you need to fix this before re-running the higher-level FEAT. The simplest way to do this is to start the FEAT GUI, change Full analysis to Registration only, select the first-level FEAT directory with the problematic registration and change the registration settings. The first thing to try is to reduce the search to No search (assuming that the data is roughly oriented correctly) and/or to change the DOF.)

If you get spare time at the end of this session, there are two other analyses of interest:

  • In the FEAT GUI, load in the design.fsf from the .gfeat directory. Change the modelling/estimation method to Mixed Effects: FLAME 1, which is nearly as accurate as full FLAME and nearly as fast as OLS. Change the output directory name to reflect this option. Under the Data tab, deselect all of the lower-level copes except 2 - this tells the group FEAT to only run the second-level analysis on the second of the first-level contrasts, not all 5. After completion (5-10 minutes), compare with the previous OLS results. The FLAME results do look "nicer", as well as there being some new plausible activations that were not previously found.
  • While the above is running, get another analysis ready to run - revert to the OLS option, and change the model to the simpler unpaired t test (use the wizard, and make sure that you understand the EVs and contrasts that the wizard sets up for you), re-run and compare with the paired t-test results.


Inspecting Multi-level FEAT Analysis

Group level analysis only takes place within voxels that have data from all subjects when projected into standard space. This means that if the first-level registrations into standard space are variable across your subjects, you may be throwing away fair amounts of data in your higher level analyses.

To check for this, we can take all of the individual subject mask volumes in standard space and add them up to see where and how much data are missing in our group analysis.

  • First cd into the ppt directory from a terminal window. This will be the most convenient place to reference all of the first level analysis.
  • Our first step in combining these masks is to concatenate them using the fslmerge program from the command line. We will create a new 'timeseries' volume called all_left_mask by typing the following (long) command:


fslmerge all_left_mask ac/ac_left.feat/reg_standard/mask at/at_left.feat/reg_standard/mask cm/cm_left.feat/reg_standard/mask df/df_left.feat/reg_standard/mask.nii.gz dn/dn_left.feat/reg_standard/mask eg/eg_left.feat/reg_standard/mask.nii.gz


  • You can load this new nii.gz file in FSLView, and press the 'Movie' button to view the masks in sequence. It should be clear that there are differences between the subjects.
  • Now we want to add all of the masks together, so that we can see which voxels are being thrown away by only having data from some subjects. To do that, type the following in the terminal:

fslmaths all_left_mask.nii.gz -Tmean all_left_mean

  • Now we should have another new volume, this time a single 3D dataset of each of the masks added to one another. If you view this in FSLView, you can see that there is a ring of data that is lost, but it's hard to see just how much data with all of the common voxels also in the volume. To remove those, we can type the following command:

fslmaths all_left_mean.nii.gz -uthrp 99 all_left_mean_missing

This replaces all voxels that are within 99% of the volume maximum value with zeros - effectively eliminating all the voxels that went into the group mask. View this final volume in FSLView to see all of the data that was thrown away in the group analysis. If you click the blue 'i' button on the bottom of the FSLView window, you can change the colormap from grayscale to something like 'hot', which might make it easier to see how the data are distributed.

If you have time, try the same process with the right.feat analyses, and compare between the two.

Personal tools