Creating design matrices by hand
When the number of subjects in your study starts to grow, the FSL GLM GUI interface becomes quite slow and cumbersome to use. In these situations, you will find it much easier to create your design matrix, contrast and F-test files manually. This is quite simple, and involves just a few steps:
- Enter the data for your design matrix, contrasts, or F-tests, using your data-editing tool of choice (e.g. Microsoft Excel, Google docs, Emacs+org-mode, Notepad).
Save your data as a plain text file, with columns separated by spaces or tabs - in Excel, saving your file as Windows formatted text should do the trick.
Use the Text2Vest tool, bundled with FSL, to convert the data into the format used by FSL.
You can name your files whatever you want, but to avoid confusion it would be wise to follow the FSL file naming convention:
Design matrix: design.mat
This one is easy - just format your design matrix in exactly the same way that you would enter it into the GLM gui, with one column for each EV, and one row for each subject. Let's say that your design matrix looks like this - each row corresponds to one subject, the first three EVs correspond to a group, and the fourth EV is a confound (e.g. age):
1 0 0 -6 1 0 0 -3 0 1 0 7 0 1 0 8 0 0 1 -4 0 0 1 -2
All you need to do is save this data as design.txt (or any other file name you fancy), then run:
Text2Vest design.txt design.mat
This will convert the design matrix data into the format used by the FSL tools, and save the matrix as design.mat.
Contrast files must have one row for each contrast, and column for each EV. For example, we have four EVs in our design matrix above. A contrast matrix for this design might look like this (three contrasts, each giving the mean activation for one of the groups in the study):
1 0 0 0 0 1 0 0 0 0 1 0
If you save this as contrasts.txt, simply run this:
Text2Vest contrasts.txt design.con
to prepare your contrast file.
F-test files must have one row for each F-test, with one column for each contrast. For example, if we are interested in activation in any of the three groups from the contrasts above, we would structure our F-test file as follows:
1 1 1
Save this as ftests.txt, and run the following to prepare your F-tests file:
Text2Vest ftests.txt design.fts
Converting design matrix files to plain text
FSL also comes with another tool, Vest2Text, which will convert your design.mat design.con and design.fts files into plain text. This can be handy if you would like to base your analsis on that of an existing one, but need to make some changes to the design. Use the Vest2Text in the same way that you use Text2Vest; for example, the following command will convert a design matrix into a plain text file called design.txt:
Vest2Text design.mat design.txt