Wednesday, December 12, 2012

Contrasts in SPM (with Outtakes!)

We have come to the end of the preprocessing pipeline, and lurch across the finish line with a discussion of contrasts. Often researchers will calculate the difference in beta estimates between two conditions (in SPM, the beta_000?.img files), and also determine whether the difference is significant or not. At the single-subject level both the magnitude of the beta estimate and the variance of the estimate is calculated for each condition, and then t-tests can be performed on these beta estimates by weighting them. For example, the contrast of [1 -1] for Left vs. Right button presses will subtract the beta estimates for the Right button presses from the Left button presses, similar to a paired t-test. A t-statistic is then calculated at each voxel using the following formula:


Where gamma represents the contrast vector (in this example, [1 -1]) and B-hat represents the beta estimates for each condition. The degrees of freedom for a single-subject analysis is based on the number of time points; although, since nearby timepoints share a high degree of correlation, the actual degrees of freedom is pared down to compensate. With most standard processing streams, the variance associated with a beta estimate is discarded when carried to a higher-level analysis, although programs such as FSL's FLAME and AFNI's 3dMEMA take this variance into account when weighting group-level estimates.

Details about how to perform a simple t-contrast in SPM are shown in the following video. The first twenty seconds or so is an outtake where my microphone fell over; we sure like to have fun around here!



4 comments:

  1. Is there way to quickly compute temporal SNR in SPM?

    ReplyDelete
    Replies
    1. Hey there,

      I haven't tried computing temporal SNR in SPM before, but you could probably use imcalc to do the following:

      1. Take the average of the signal of your warped and scaled data;

      2. Calculate the standard deviation of the data;

      3. Divide Step 1 by Step 2;

      4. Multiply the result of Step 3 by a mask, if you want.

      Note that in AFNI they recommend taking the standard deviation of the error time series, which I believe it analogous to the ResMS.nii file created after estimating a GLM. I'm not positive about that, however...

      -Andy

      Delete
    2. Thanks for your reply, Andy! By reading your comment, I have just realized that I need the contrast to noise ratio, not the the tSNR :) Do you know how to compute the CNR in SPM?

      Delete
    3. If you want the CNR of tissue types, then you could take the difference of the mean intensity of the gray matter and white matter, and divide it by the standard deviation of voxels outside the brain. For CNR of the signal, you could take a contrast map and divide that by the standard deviation of the ResMS.nii file. I'm not 100% sure of this approach, but that's my best guess. See this article for more information: http://onlinelibrary.wiley.com/store/10.1002/jmri.20935/asset/20935_ftp.pdf;jsessionid=C95EFA680F898A1FCC32A6BB0F62C19A.f02t03?v=1&t=iwm816t0&s=4b324eafd8ff23a367e69ab3b930bc3fd043a121

      Best,

      -Andy

      Delete