JIM: DATA ANALYSIS METHODS
DISCLAIMER: The following is a very raw and rough attempt at prodding through a multi-stimulus dataset.I have tried to leave a transparent trail for those foolish enough to try and follow what I did. Hopefully it makes at least partial sense and I tried to keep it short and sweet. Hopefully the links to the PNMS will be made available so that cruising through this is as painless as humanly possible. Please note that lime green colored text in a 14 font is the command line text I ran in order to transform the data. Also of note are specific files are coded in a 14 font in orange and eventually clicking on these will bring up pretty pictures.
This is my crack at trying to work through this more complicated experiment.As you know we copied the data via nfs from prana to microquasar. This copied data was stored in the directory E56_2/E56.
So our first problem wrt byte swapping was solved.
Next I used an afni command line program to concatenate the four different runs: jim1, jim2, jim3 and jim4. I concatenated sub-bricks 5-156 of each of the runs to end up with a new concatenated dataset Jim1234+orig that contained 608 sub-bricks. This is the syntax:
3dTcat -prefix Jim1234 'jim1+orig[5..156]' 'jim2+orig[5..156]' \
'jim3+orig[5..156]' 'jim4+orig[5..156]'
The next step I employed was to motion correct each of the 608 sub-bricks.This is even more important in this situation because our large dataset is actually a conglomerationof four smaller datasets taken at different times. Thus we need to correct not only the in trial motion but also the between trial movements. The syntax used in this example was:
2dImReg -input Jim1234+orig -base 5 -prefix V_Jim1234
OK, now we have what we need with respect to raw data. We have a concatenated motion corrected dataset.Of note here is that we were able to concatenate because it was the same subject performing the different runs.If one is dealing with multiple subjects it is wiser to avoid concatenating multiple subjects. Rather, one is advised to run 3dDeconvolve separately and then merge the subjects' statistics afterwards.
THE EXPERIMENT:
What makes analysis of this experiment more challenging is that it involves the used of four different stimuli. Each stimuli occurs an equal number of times and for the same duration.The appearance of the stimuli is somewhat predictable in the sense that each stimulus appears for two blocks but also it is somewhat varied as the order of the stimuli changes during the experiment.
We will use the following shorthand for simplicity purposes'
CW = color word, 1L = 1st letter, SA = Semantic Associate, CT = Control
Each of these stimuli appears for 6 TR followed by 13 blanks.This set of 19 scans is repeated twice for a total of 38 TR and this block of 38 appears 4 times in the concatenated dataset.
Here is the order of the stimuli
CW, SA, 1L, CT, 1L, CW, SA, CT, SA, CW, 1L, CT, SA, 1L, CT, CW
Notice that there are 16 blocks of 38scans (16X38=608) which corresponds to the number of time points (608) in the concatenated datasets.
Now we must compose a 1D stimulus file for each of the four stimuli.This file consists of ones where the stimuli is active and 0s where it is not. Of course this file must also have 608 values. This file is stored as one column with 608 values but for explanation purposes I will use rows instead of columns.
What I did to conserve time was to make up two text files of 38 values.
Active (consisting of 2 runs of 6 1s followed by 13 0s)
1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0
and
38 zeroes
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
For shorthand we will refer to Active as A and 38 zeroes as Z.
So to make a stim file for CW we need to paste those two in the following order:
A, Z, Z, Z, Z, A, Z, Z, Z, A, Z, Z, Z, Z, Z, A to match
CW,SA, 1L, CT, 1L, CW, SA, CT, SA, CW, 1L, CT, SA, 1L, CT, CW
Look at file color_word.1D
I followed the same protocol to create 1D files for the other three stimuli:
semantic_assoc.1D
control.1D first_letter.1DNow would be a good time to check that you did everything OK. There are a couple of ways to do this. Quickly you could open file manager and check to make sure that each of these files contains 608X2 = 1216 bytes. This will tell you that there are the right number of rows.
Perhaps, a quick graphical check of these stimuli would help set your mind at ease.
The command line
1dcat color_word.1D semantic_assoc.1D first_letter.1D control.1D > Overlay.1D
creates a 1D file Overlay which can be plotted using 1dplot. When this is done all four stimuli will be represented in boxcar form.In this manner you can check that each stimulus occurs 8 times and at the correct time etc. Once you have finished this you are ready to move on.
MAKING A MASK
Making a mask datset has already been more than adequately dealt with. I made a copy of the dataset and then made a mask using the plugin Draw Dataset.View the mask here:
MASK2.pnm
The mask is necessary to avoid calculating statistics on regions that are not part of neural response such as outside the cranium as well as the eyes. This serves the two-fold advantage of both speeding computation time and avoiding "silly activations".
PERFORMING GENERAL LINEAR TESTS
This is the meat of our analysis. It is the whole reason we are performing the experiment. In order to compare activations between stimuli it is necessary to create matrices that express our hypotheses in ones and zeroes.
A quick overview of the 3dDeconvolve parameter vector is needed.
3dDeconvolve goes through data and first removes the constant and linear trend for each activation.Then it goes about analyzing the activations of different stimuli.
In this experiment I am testing whether the are under the curve of a particular stimulus is different than the area under the curve for a different stimulus.I used the area under the curve from TR2 (min_lag) to TR5 (max_lag). In this way I am comparing the response at its maximum and am not including undershoots.
By convention (my convention):
Stimulus 2 is Semantic Associate
Stimulus 3 is First Letter
Stimulus 4 is Control
So the parameter vector that 3dDeconvolve will be finding contains 8 (a constant and linear trend for each stimulus) plus 16 (four timelag values [2, 3, 4, 5] for each stimulus) for a total of 24 values.
Now that that is clear as mud we can use it to our advantage.
In this experiment one of the combinations that is of interest is SA minus CT. This can be represented by the matrix
0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 -1
-1 -1 -1
con. & lin trend
CW
SA
1L
CT
Of course you would save this as a row not a column and without any odd spaces or words.
Examine the file
SA-CT_min2_max5.mat
Identical reasoning was used to make the file
CW-1L_min2_min5.mat
I also used this reasoning to make a file that tested the entire hypothesis that
CW - 1L = SA - CT or SA + 1L - CT - CW = 0
0 0 0 0 0 0 0 0 0 -1 -1 -1 -1 1 1 1 1 1 1 1 1 -1 -1 -1 -1
This is contained in the file
SA+1L-CW-CT.mat
One last quick piece of information to know before the syntax for the 3dDeconvolve stuff is revealed.Because Jim1234+orig is a concatenated dataset mad of four different datasets it is necessary to create a small file that states when to begin analyzing a new constant and linear trend.In our case I made a file containing the numbers
0
152
304
456
and saved it as
runs.1D
Just a couple of reminders before we are ready to proceed. Ensure that all of the *.1D as well as the *.mat files are in the same directory as your data when you go to run this. Also ensure that the mask as well as other auxillary files are in the same directory and this will save some headaches.
So here it is
3dDeconvolve -input V_Jim1234+orig -mask MASK2+orig \
-polort 1 -concat runs.1D -num_stimts 4 \
-stim_file 1 color_word.1D -stim_label 1 color_word \
-stim_minlag 1 2 -stim_maxlag 1 5 \
-stim_file 2 semantic_assoc.1D -stim_label 2 sem_assoc \
-stim_minlag 2 2 -stim_maxlag 2 5 \
-stim_file 3 first_letter.1D -stim_label 3 first_letter \
-stim_minlag 3 2 -stim_maxlag 3 5 \
-stim_file 4 control.1D -stim_label 4 control \
-stim_minlag 4 2 -stim_maxlag 4 5 \
-glt 1 CW-1L_min2_max5.mat -glt_label 1 CW-1L_min2_max5 \
-glt 1 SA-CT_min2_max5.mat -glt_label 2 SA-CT_min2_max5 \
-glt 1 SA+1L-CW-CT.mat -glt_label 1 SA+1L-CW-CT \
-fout -tout -rout \
-bucket MASK2_V_Jim1234_mn2_mx5
So quickly I'll run through the basics of the command line as well as a brief overview of the pnms that accompany this data and how I made them.
OK so first we see that the input dataset is the volume corrected concatenated set I explained from page one of this document.
The mask I used is MASK2+orig which there is a picture of on pg 3
-polort 1 means that the model includes a constant and linear trend in the parameter vector.
There are 4 stimulus files that will be called up during the analysis.
Stim_label just refers to how the sub-brick will be labeled in the bucket dataset.
Min/max_lag means that the model will be calculated following the stimulus from 2TR until 5TR
The various glts have been explained on page 4.
The f-stats (for each stimulus and glt), R2-stats (for each timelag, stimulus and glt) and t-stats (for each time lag) will be stored as sub-bricks in the bucket dataset:
MASK2_V_Jim1234_mn2_mx5
This dataset will appear in the functional menu in AFNI
You can either just link to the pnms or you can load up afni and look at the data yourself.
Load up the ax anatomicals
Switch Function to the MASK2_V_Jim1234_mn2_mx5+orig (f:buc 67) dataset
So this bucket dataset has 68 sub-bricks in it. I'll point out the ones I used to make the pictures.
First I made some simple pictures of each of the different stimuli.
Now for these ones I used the sub-brick that contained the F-stat as the threshold sub-brick and the sub-brick that contained the R2 stat as the Func sub-brick.
So for example the color_word pnm used #24 as the func and #25 as the Thr. Also because the R2 stat is a goodness of fit stat and not a %change sort of statistic I altered the color code. I used a color scheme of
0.00-0.20 grey
0.20-0.35 red
0.35-0.50 orange
0.50-1.00 yellow
This gave the following pnms at two different p-values.
ColorWord_MASK2_V_Jim1234_m2_m5_p0.01.pnm
ColorWord_MASK2_V_Jim1234_m2_m5_p0.001.pnm
For the Semantic Associate stimulus I followed the same reasoning using sub-brick #34 as the func and #35 as the Thr sub-bricks to get these
SemAssoc_MASK2_V_Jim1234_m2_m5_p0.01.pnm
SemAssoc_MASK2_V_Jim1234_m2_m5_p0.001.pnm
And for First Letter I used #44 and #45 whereas Control used #54 and #55 to give these
FirstLetter_MASK2_V_Jim1234_m2_m5_p0.01.pnm
FirstLetter_MASK2_V_Jim1234_m2_m5_p0.001.pnm
Control_MASK2_V_Jim1234_m2_m5_p0.001.pnm
Control_MASK2_V_Jim1234_m2_m5_p0.001.pnm
Hope that is understandable.
For the GLT stuff I used the sub-brick that contained the LOC stat. For this stat I used the normal 0-0.05, 0.05-0.10, 0.10-0.15 and >0.15 as the color coding. This is because the LOC is telling us how much bigger one stimulus is than another - like a percent change sort of thing.
For all of these pnms colors that are hot (yellow/orange/red) means that the stimulus that has a positive sign is greater than the negative signed stimulus. Whereas, the reverse is true in regions where the brain is lit up in cool tones (blues) Good!!
To compare SA-CT we used #59 (LOC) as the Func sub-brick and #61 (F-stat) as the Thr sub-brick.
This gave us the following
SA-CT_MASK2_V_Jim1234_m2_m5_p0.001.pnm
And for CW-1L we used sub-bricks#56 and #58 to give us this pnm
CW-1L_MASK2_V_Jim1234_m2_m5_p0.001.pnm<
Lastly I tested the entire hypothesis using the sub-bricks #62 for the Func and #64 for the Thr to give this pnm.The hypothesis was that this pnm should have no activation. Judge for yourself:
MASK2_V_Jim1234_m2_m5_hypothesis_p0.01.pnm
MASK2_V_Jim1234_m2_m5_hypothesis_p0.001.pnm