Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The "Vertex Analysis: requires you to prepare two sets of files: the individual segmented structures combined into one file, and a design matrix to indicate which file belongs to which groupand t and f contrasts saved as a set of files

Table of Contents

Combining individual files: concat_bvars

Outcome: a single file that contains all studies' bvars files, for a given structure.

In a terminal, navigate to the directory with all the bvars files, e.g., [user@localhost temp]$ cd /mnt/hgfs/LinuxShare/temp

...

Design matrix and contrast files

Outcome: a group of files than are used to run statistical analyses; these are not specific to a structure (and so can be copied across structures to repeat the same analysis).

The design matrix is common to FSL statistical routines, and is the same as created in SPM. However, for FIRST there are some differences (see "Create a design matrix" in guide). Specifically, the group should be in one rather than two columns, and F tests should be used. Follow these steps:

1) Open Glm

need to be created. Furthermore, the file format is different in SPM and FSL: in FSL, there is a custom design matrix, and t-contrast and f-contrast files are created at the same time as the design matrix. This is different to SPM where the design is specified, then any t or f contrast can be created from that design.

(An older version of these instructions is here, in case yuo do not have the variable files.)

Before you start, make sure you have opened the variable file (e.g., "...\LinuxShare\FIRST\ID99N20G2\varfiles\allvariables.txt"). Follow these steps in Linux (unless other specified):

1) Create a folder for this design

Either using the File Browser or the mkdir command in the terminal, create a folder.

By default, create a top-level folder called "designs," and subfolders for each design under that. Suggested convention is illustrated by these examples :

  • .../LinuxShare/FIRST/ID99N20G2/designs/2sample/
  • .../LinuxShare/FIRST/ID99N20G2/designs/2group_covage/
  • .../LinuxShare/FIRST/ID99N20G2/designs/1group_covagesex/
  • .../LinuxShare/FIRST/ID99N20G2/designs/correlationage/
  • .../LinuxShare/FIRST/ID99N20G2/designs/correlationage_covsex/
  • .../LinuxShare/FIRST/ID99N20G2/designs/regressionageAHI_covsex/
2) Open a terminal in this "design folder"
3) Open Glm
 

Either start from the FSL GUI (if so, open fsl in the design folder), or from a terminal "cd" to the directory, and type Glm (case sensitive).

2) Enter the total number of subjects, and the number in the first group (if using a two-group design)

Select Example:

Image Added

4) Select "Higher-level / non-timeseries design" from the pull-down menu

...

.
5) Enter the number of

...

studies (# inputs)

...

 

Image Removed
3) Adjust the design to have one column for group

Go the to General Linear Model window, and set to 1 EV; the Group B column will disappear.

Image Removed

4) Change the second group EV value from 0 to "-1" 

Scroll down to the second group (where values change from 1 to 0 in EV1 column); change all the "0"'s to "-1" (tedious).

Image Removed

5) Set one T contrast and one F contrast

...

.
6) Enter the number of variables in your design as number of EV's.

"EV's" at the top of the GUI, not voxel-dependent EV's at the bottom. This will add that number of columns to the design. Do not count the "Group" column in the GUI (the group variable must be pasted as an EV).

7) Click "Paste," then "Clear"

8) In Windows, open the allvariables.txt in Excel. Select the data (not headers) you want to use for the design.

"Hide" columns to skip them; the columns must be contiguous, but you can exclude those on the left or right.

9) In Linux, click in the empty "Paste" window, and click Ctrl^Y to paste the values. Click OK.

Ctrl^V does not work, for some odd reason. Right-click does not give a Paste option either. Remember to paste the group variable along with other variables. 

10) Enter the column names.

 

12) Click "Contrasts & F-tests" tab

13) Create contrasts:

To compare the means of two samples,

and set to one Contrast, one F-test, and select the C1 contrast for the F1 (click on the small square).Image Removed6

set both Contrasts and F-tests to 1. Make sure the box next to C1 is selected (it should be yellow). Select the F1 box. 

Image Added

11) Save the file

Under the GLM Setup window click Save, navigate to the directory with the files, and choose a descriptive name ("des_2sample" for example; you can use des_[folder name] using the name of the design folder). You can ignore the warning.

This will save a number of files, as in the example below (where "des" was chosen as the name). These files are used as input to several of the following procedures.

Other designs (covariate, more groups)
Covariates are added as extra columns (add an "EV"), as explained in the Glm user guide.Note that these examples do not have the group variable set up as above, so you will need to change from a column per group to a single column with different values for each. (For example see the Two-Group Difference Adjusted for Covariate in the user guide.)

Moving the files to a separate folder

Because the stats only needs the design matrix and combined all.bvars files, these can be copied to subfolders for the next stages; this helps keep everything organized. Since you will likely be doing multiple models and statistical analyses, you can create as many well-named folders as you like, and copy the same set of design matrix & all.bvars files.

Background on design matrix

The design matrix is a text file with header information and numbers in columns. By tradition, the file is saved with a name like "design.mat". Each row represents a subject, in the order stored in the concatenated bvars file. The simplest design matrix (for a two group dataset) is a single column, with +1 for group 1 and -1 for group 2. A default matrix created by Glm for two groups includes two columns, but this is not what is needed for FIRST. There is also header information which includes the number of columns (I think), the number of subjects, and the maximum value of each column. For example, here is a two-group, 5 subjects/group design matrix:

Image Removed

You will copy the design folder, including all the files, to subfolders of each structure you analyze.

Tip: Glm from FSL GUI

Type "fsl" to start the FSL GUI, click "Misc " then "GLM Setup".

...