Connectivity lab
From NITP Summer Course Wiki
Contents |
Dynamic Causal Modeling in SPM
Setting up SPM
We will be using the sample dataset provided by the SPM group to do a basic DCM analysis.
- As SPM is a Matlab toolbox, first launch Matlab (the icon should be in the dock).
- SPM is not in the path on the lab computers by default, so you must type the following command to add it:
path(genpath('~/MATLAB/'),path)
- Once you've done that, type spm fmri to start spm in fMRI mode.
The data we will be analyzing are located in the ~/FSL/attention directory.
- Create a new sub-directory inside of attention to store the analysis files we will create, and copy the factors.mat, factor_time_series.mat and corr_look.m files there.
- Now change Matlab to be in the directory you just created. You can either use a cd command in the Matlab command window like we do in the Terminal, or use the graphical interface.
- Once there, type the command load factors, which should create variables describing the time course of the three variables we will be modeling in this exercise.
Setting up the GLM
We will now set up the GLM model for these data.
Begin by specifying a 1st level analysis.
- Click the Specify 1st Level button
- Choose the directory you just created to be the location of the SPM.mat file under the Directory option.
Under Timing Parameters:
- Units in Scans
- TR (Interscan Interval) = 3.22
Under Data and Design
- Select a New "Subject/Session"
For that Subject/Session that appears in the tree, enter the following:
Scans - select the functional directory from ~/FSL/attention, and then use the shift key to select all 360 volumes in that directory.
Now we well create three Conditions for this run:
1. photic: this comprises all conditions with visual input. 2. motion: this includes all conditions with moving dots. 3. attention: this includes the attention-to-motion (A) condition only.
Under Conditions, select New Condition.
- Name the new condition "Photic"
- Under Onsets, type phot - this will expand one of the variables we loaded from the factors.mat file earlier.
- Under Duration, set it equal to 10.
- Create 2 more Conditions, the next being called "Motion" using the Onset variable mot and a 10 second Duration, and the last being called "Attention" with the Onset att and the same Duration of 10.
We can accept the rest of the defaults, so you can now press the "Run" Button.
After that has completed, the design matrix should be displayed.
We can then run the model by clicking the "Estimate" button, and selecting the SPM.mat file we have created in the temporary directory. Use the default Classic model.
Once that has completed, we need to define t contrasts for each of the factors in the model.
- Click the "Results" button
- Select the SPM.mat file we have been using.
- Choose to define a new contrast.
- Name the Contrast "Photic", and specify it as [1 0 0 0]
Build two more contrasts for the other conditions:
- "Motion" - [0 1 0 0]
- "Attention" - [0 0 1 0]
Be sure to select one of these contrasts and press 'Done' to view the results. You can accept all of the default values when prompted.
From this point forward, we can define specific volumes of interest (VOIs) and use them as the basis for our DCM analysis.
The SPM5 manual walks through the remaining steps of this analysis using this sample dataset. Linked below is the excerpt from the manual explaining the final steps along with screenshots. Read from the beginning to verify you have analyzed the data consistent with the manual instructions, and you should be ready to continue with the masking instructions starting on the top of page 259.
NOTE: To specify an VOI once you've centered the cursor in the desired location, you need to press the 'eigenvariate' button in the middle of the Results window.
