|
| 1 | +# Second-level analysis example |
| 2 | +The material here is for students doing the **CLNE0068: Research Methods and Data Analysis in Human Neuroscience** course at UCL. |
| 3 | + |
| 4 | +First of all, create a folder to save your results into. |
| 5 | +Then start MATLAB and type |
| 6 | +```matlab |
| 7 | +spm fmri |
| 8 | +``` |
| 9 | + |
| 10 | +## Loading participant information |
| 11 | + |
| 12 | +Age and sex of the participants is stored in a spreadsheet. |
| 13 | +You can load this information into MATLAB by typing the following: |
| 14 | +```matlab |
| 15 | +filename = 'S:\FBS_CLNE0068\Data\Faces\Subject_details.xlsx'; |
| 16 | +contents = readmatrix(filename,'OutputType','string') |
| 17 | +subjects = contents(:,1); % Participants |
| 18 | +age = str2double(contents(:,2)); % Convert text into numbers |
| 19 | +sex = double(contents(:,3)=="F"); % One denotes female, zero denotes male |
| 20 | +``` |
| 21 | + |
| 22 | +This gives `age` and `sex` variables in the MATLAB workspace that can be entered into a design matrix. |
| 23 | + |
| 24 | + |
| 25 | +## Specify 2nd-level |
| 26 | +Press the `Specify 2nd-level` button on the "Menu" window to get a `Factorial design specification` job in the batch editor. |
| 27 | +Modify the design so it looks like the following |
| 28 | +```matlab |
| 29 | +Directory [specify the directory you created] |
| 30 | +Design |
| 31 | + . Multiple regression |
| 32 | + . . Scans [select the 1st-leve contrast images] |
| 33 | + . . Covariates |
| 34 | + . . . Covariate |
| 35 | + . . . . Vector [enter the age variable] |
| 36 | + . . . . Name age |
| 37 | + . . . . Centering Overall mean |
| 38 | + . . . Covariate |
| 39 | + . . . . Vector [enter the sex variable] |
| 40 | + . . . . Name sex |
| 41 | + . . . . Centering Overall mean |
| 42 | + . . Intercept Include Intercept |
| 43 | +Covariates |
| 44 | +Multiple covariates |
| 45 | +Masking |
| 46 | + . Threshold masking |
| 47 | + . . None |
| 48 | + . Implicit mask Yes |
| 49 | + . Explicit mask |
| 50 | +Global calculation |
| 51 | + . Omit |
| 52 | +Global normalisation |
| 53 | + . Overall grand mean scaling |
| 54 | + . . No |
| 55 | + . Normalisation None |
| 56 | +``` |
| 57 | +You can save this as `second_level_spec_job.m` and click the green run button (unless you've forgotten anything) to save the specification. |
| 58 | + |
| 59 | +Once this has finished, you can `Review` the model if you like, and then press the `Estimate` button on the "Menu" window. |
| 60 | +Select the `SPM.mat` file that has just been created and press the green run button. |
| 61 | +Wait a little while until this finished before going on to looking at the results. |
| 62 | + |
| 63 | + |
| 64 | +## 2nd-level Results |
| 65 | +Press the `Results` button on the "Menu" window and select the `SPM.mat` file in order to open the contrast manager. |
| 66 | +there are a few things you could look at from this model. |
| 67 | +Remember that the columns of the design matrix correspond with: |
| 68 | + |
| 69 | +1. `mean` - a column of ones to model the mean |
| 70 | +2. `age` - the participants' ages (years) |
| 71 | +3. `sex` - whether or not the participants are female (1=female, 0=male) |
| 72 | + |
| 73 | + |
| 74 | +### Main Effect |
| 75 | +When the aim is to assess whether the average values in the contrast image are greater than zero, we can simply assess the first beta image, which encodes the mean. |
| 76 | +The t contrast vector to do this is |
| 77 | +```matlab |
| 78 | +1 0 0 |
| 79 | +``` |
| 80 | +Note that this is an ANCOVA model because effects of age and sex are covaried out. |
| 81 | + |
| 82 | +### Any age effect |
| 83 | +Age is encoded by the second column of the design matrix. |
| 84 | +To see both positive and negative age effects, we would need a two-tailed t test. |
| 85 | +This can be achieved using an F contrast of |
| 86 | +```matlab |
| 87 | +0 1 0 |
| 88 | +``` |
| 89 | +With data from only 16 participants and three columns in theh design matrix, the statistical analyses have only 13 degrees of freedom. |
| 90 | +It may therefore not be very sensitive to age-related effects. |
| 91 | + |
| 92 | +### Any age or sex effect |
| 93 | +Now we are intersted in any variance explained by the second and third columns of the design matrix. |
| 94 | +This can be done using the following F contrast: |
| 95 | +```matlab |
| 96 | +0 1 0 |
| 97 | +0 0 1 |
| 98 | +``` |
| 99 | + |
0 commit comments