Event-Related

From VISTA LAB WIKI

Jump to: navigation, search

Event related analyses compute a relationship between the stimulus time course and the BOLD time course. To compute this relationship, they need (a) the BOLD time series and (b) a definition of the stimulus design, called the Design Matrix (DM). For most cases, the analysis will calculate a predicted time series, based on a definition of the hemodynamic response function (HRF). An additional level of analysis is possible, in which the time course of each event type is estimated from the data, by constructing a separate predictor for each time point within the peri-stimulus time course for each event type (This subset of GLM analyses is called "deconvolution" and is discussed below).

The term "event-related" may be somewhat of a misnomer, since these analyses can apply equally well to event-related, block-design, or traveling wave design experiments. The term in this case is used to refer to the fact that the analysis is based on constructing separate predictors for different event types, which are described by the design matrix. This is as opposed to the corAnal, which mainly applies to the cyclic, traveling-wave design of experiment. Due to a legacy from previous naming conventions, the traveling-wave designs are sometimes described as 'blocked' (e.g., the 'blockedAnalysisParams' in the dataTYPES variable).

This section of the manual describes how we (a) manage the construction of the design matrix, (b) compare estimated and predicted time series, (c) estimate the so-called 'beta' weights. Later, we will add information about the statistical treatment of the beta-weights and methods for visualizing the results.

Nearly all of the event-related code was written and designed by Rory Sayres in the Grill-Spector lab. Several members of the Wandell lab have started to use the code, and it has been used extensively in the Grill-Spector lab. The results have been compared with SPM, and several features (e.g., estimation of beta-weights) agree perfectly.

Contents

[edit] Creating the Design Matrix

After you collect the data and run mrInitRet, follow these steps to create a Design Matrix for the event-related analysis.

1. Create a set of text files that contain the stimulus protocol for each scan. These are called parfiles.

An example of a parfile is:
0 0 Fixation
12 1 Condition1
24 0 Fixation
36 4 Condition4
...

The first column is the first time (in seconds) of each event. The second column is the condition number (use 0 for fixation or baseline). The third column is the condition name. The condition name only needs to be specified the first time a condition type appears. Each column must be delimited with a TAB character (which can be produced by fprintf('\t')), or the parfile won't be properly read in. While most text editors / spreadsheets add this character when you press the TAB button, some will only add spaces; be careful of this. You can usually export to 'tab-delimited ASCII text' or some variant to save it properly. In matlab, you can also use the function writeParfile to write it out.

You can also specify an optional fourth column with colors associated with each condition. Like the third column, you only need to specify this for the first time a given condition appears. The color specification must be in the format [R G B], where R, G, and B are numbers from 0 to 1 specifying the red, green, and blue intensity of the color, respectively. The brackets are not required, but are ok. So, for example:

0 <TAB> 0 <TAB> Fixation <TAB> 0 0 0
12 <TAB> 1 <TAB> Condition1 <TAB> 1 0 0
24 <TAB> 0 <TAB> Fixation <TAB>
36 <TAB> 4 <TAB> Condition4 <TAB> 0 0 1
...

Would assign black ([0 0 0]) to condition 0, red ([1 0 0]) to condition 1, and blue ([0 0 1]) to condition 4.

2. These files should be located within sessionDir/stim/parfiles or sessionDir/Stimuli/parfiles. The file names should be yourChoice.par, for example PhaseW1_78rep.par.

These files will be used to make the design matrix of the GLM.

3. You must then assign the parfiles to each of the individual scans. You do this with the menu item Event-Related | Assign parfiles to scans. The menu that comes up shows the individual scans (listed by the name you gave them). To assign you select, say, one of the scans. Then a new menu will appear showing you the parfiles. You select the parfile for that scan.

If you select all of the scans and an equal number of parfiles, the assignment will be matched, one-to-one in the corresponding order. (Be sure to avoid selecting '(None)' as an option.)

If you want to verify the assignments, you can type

   dataTYPES.scanParams.parfile

or you can select EventRelated | Show scan group / parfiles. This option will show a dialog with the scans assigned to the current scan's scan group (if there are any), and the parfiles assigned to each scan in that group.


[edit] Group related scans together

  1. Go to EventRelated | Grouping | Group Scans.
  2. Select the set of scans which you want to consider together. Use Ctrl-Left Click to select non-contiguous scans, Shift-Left Click to select contiguous scans. Select OK.
  3. This will set the 'scanGroup' parameter (stored in the datatTYPES.scanParams field) for each of these scans, indicating that for event-related purposes (including GLMs, contrast maps, and plotting time courses), the scans should be considered together.
  4. You can also use the 'Select Scans...' option at each subsequent step, if you're uncertain which group of scans you want to consider together. This just saves time. You can also change the scan group later.


[edit] Compute the GLM weights

[edit] Old Version of code (based on FS-FAST algorithm): Applying an HRF

When you estimate the GLM parameters, you are asked to set various conditions through a user dialog.

GLM user dialog caption



The computation takes about 10 minutes in 2006 on a 3GHz machine for a typical session with 6 scans (180 sec).

Command-line function: er_runSelxavgBlock, er_selxavg.

Compute a contrast map: select 'EventRelated' | 'Compute Contrast Map' | 'Scan Group'. (Shortcut: Ctrl-5).

A dialog will pop up with a list of the conditions found in the parfiles for this scan, as well as checkboxes to select which are the active (+) and which are the control (-) conditions. There will also be edit fields to manually set weights for each condition. This is useful if you have some conditions you expect to elicit a proportionally stronger response than others.

Command-line function: computeContrastMap.

[edit] New Version of code

This version of the code is more memory-intensive, and less thoroughly tested, but seems to work well . It always saves the result of a GLM in a separate 'GLMs' data type.

To use: Select the menu 'EventRelated' | 'Apply GLM (new code)' | <scan selection>. Command-line functions: applyGlm

This code also produces several additional maps showing intermediate results of the GLM. In the GLMs/RawMaps/ directory, there are maps containing beta weights and estimated standard deviations for each condition. In the GLMs/ directory, there is a map for the residual variance of the GLM fit, as well as the proportion variance explained. (The proportion variance explained is equal to the Pearson's correlation coefficient (R^2) between the best predictor and the original time series.)

After applying the GLM, to compute a contrast map, select the appropriate scan/analysis in the GLMs data type and select 'EventRelated' | 'Apply GLM (new code)' | 'Compute Contrast Map'. You will get a dialog to enter the active (+) and control (-) conditions for the comparison. There is also an 'advanced options' panel, which lets you set weights for each condition, and the units of the map. By default, this is 'significance level' of a contrast: that is -log10(p) for a T test between the active and conrol conditions, with negative values indicating a significant T value in the opposite directions. (So, sig=2 indicates that (+) is higher than (-) with p=0.01, sig=3 mean p=0.001, and sig=-5 indicates (-) is higher than (+) with p=0.00001.) You can also select the raw statistical value (T value, though F tests are also possible using the command-line code), or raw p value.

Command-line function: computeContrastMap2.

[edit] Selecting ROIs and viewing time courses

Contrast maps computed using the GLM code can be loaded as standard parameter maps in mrVista; they can be thresholded by the 'mapWinMin' and 'mapWinMax' sliders to the right side of each view window. If you want to view two sides of a contrast map -- for instance, if you have a contrast "StimA_Vs_StimB" and want to see both regions which respond significantly to stimulus A > B and B > A, you can select the menu: Colormap | Parameter Map | Bicolor (Winter + Autumn) Color map. This sets the color map such that negative values (B > A) are colored in a winter colormap, while positive values (A > B) are colored with an autumn color map. It also maps the absolute value of the statistical signficance onto the 'cothresh' slider. So, setting cothresh = 0.03 would show regions which have (-log(p) > 3) and (-log(p) < -3). (Some more formal tools for showing multiple overlays are in the mrViewer program in the mrVista2 repository.)

You can select regions of interest (ROIs) from the map using the various utilities in the ROI menu. Once an ROI is defined, you can visualize the time series data in that ROI in one of two ways. First, you can launch a Time Course UI, which offers several options for viewing the mean time course across voxels in the ROI: menu EventRelated | TimeCourseUI | (scan selection). You can also use a Multi Voxel UI tool to view response patterns across voxels in the ROI: EventRelated | MultiVoxelUI | (scan selection).

[edit] List of function names

  • er_assignParfilesToScans(view, [scans, parfiles]);
  • eventMenu(): attaches the event-related analysis menu to a figure or sub-menu.
  • functions for the "Old" implementation of the GLM:
    • er_selxavg(): the core of the FS-FAST implementation of the GLM. (Old code, but stable.) This locks you in to using the hemodynamic response function described by Dale and Buckner, 1997, although you can set the tau and delta parameters for this. Results are always saved in the first scan of your scan group.
    • er_runSelxavgBlock(view, scans): wrapper used to call er_selxavg for a mrVista data view.
    • computeContrastMap(): compute a contrast map on a view, after running er_selxavg.
  • functions for the "New" GLM implementation:
  • glm(Y, X): the core (new) GLM code. Computes X/Y for design matrix X and data Y. Y may contain many voxels, and will compute the GLM at once for all of them, returning a model struct which has many fields useful for computing contrast maps or other analyses.
    • applyGlm(view, scans): new way to apply a GLM to all voxels in a data view. Instead of storing the results in the first scan of your scan group, creates a separate scan entry in a special data type, 'GLMs'. This allows you to run multiple analyses, using e.g. different parameters or different subsets of scans (for instance, if you think some scans are noisy, and want to see the analysis both excluding and including those scans), and store the results separately.
    • applyGlmSlice(view, scans, slice): apply a GLM to a single slice of time series data for a view, and return the model struct.
    • computeContrastMap2(view, active, control, name, [options]): Compute a contrast map on a GLM analysis, run using the new code. The view should be pointing to the 'GLMs' data type.

[edit] References

  1. Template:Ref Burock MA, Dale AM., 2000. Estimation and detection of event-related fMRI signals with temporally correlated noise: a statistically efficient and unbiased approach. Hum Brain Mapp. 2000 Dec;11(4):249-60. PubMed
  2. Free Surfer Formulation of event-related analyses
  3. Paper describing motivation behind BOLD event-related contrast
Personal tools