2nd level analysis design matrix, contrasts and inference Deborah Talmi & Sarah White Overview Fixed, random, and mixed models From 1st to 2nd level analysis 2nd level analysis: 1-sample t-test 2nd level analysis: Paired t-test 2nd level analysis: 2-sample t-test 2nd level analysis: F-tests Multiple comparisons Overview Fixed, random, and mixed models From 1st to 2nd level analysis 2nd level analysis: 1-sample t-test 2nd level analysis: Paired t-test 2nd level analysis: 2-sample t-test 2nd level analysis: F-tests

Multiple comparisons Fixed effects Fixed E.g. effect: A variable with fixed values levels of an experimental variable. Random vary. effect: A variable with values that can E.g. the effect list order with lists that are randomized per subject The effect Subject can be described as either fixed or random Subjects

in the sample are fixed Subjects are drawn randomly from the population Typically treated as a random effect in behavioural analysis Fixed effects analysis The factor subject treated like other experimental variable in the design matrix. Within-subject variability across condition onsets represented across rows. Between-subject variability ignored Case-studies approach: Fixed-effects analysis can only describe the specific sample but does not allow generalization. Experimental conditions Constants Regressors

S1 S2 S3 S4 S5 Covariates Random effects analysis Generalization to the population requires taking between-subject variability into account. The question: Would a new subject drawn from this population show any significant activity? Mixed models: the experimental factors are fixed but the subject factor is random. Mixed

models take into account both withinand between- subject variability. Overview Fixed, random, and mixed models From 1st to 2nd level analysis 2nd level analysis: 1-sample t-test 2nd level analysis: Paired t-test 2nd level analysis: 2-sample t-test 2nd level analysis: F-tests Multiple comparisons Relationship between 1st & 2nd levels 1st-level analysis: Fit the model for each subject using different GLMs for each subject. Typically, Define one design matrix per subject the effect of interest for each subject with a contrast vector.

The contrast vector produces a contrast image containing the contrast of the parameter estimates at each voxel. 2nd-level analysis: Feed the contrast images into a GLM that implements a statistical test. 1 level X values st Convolved with HRF Convolution with the HRF changes the onsets we enter (1,0) to a gradient of values X values are then ordered on the x-axis to predict BOLD data on the Y axis. 1 level parameter estimate st Y=data = ax + b slope (beta)

intercept = , predicted value = y i , true value = residual error Mean activation Contrasts = combination of beta values Vowel - baseline Vowel - baseline 1 Vowel =23.356 .con =23.356 Tone - baseline 1 Vowel beta =23.356 Tone beta2 =14.4169 .con =8.9309

Vowel - baseline Tone - baseline Vowel - Tone Contrast images for the two classes of stimuli vs. baseline and vs. each other (linear combination of all relevant betas) Difference from behavioral analysis The 1st level analysis typical to behavioural data is relatively simple: A single number: categorical or frequency A summary statistic, resulting from a simple model of the data, typically the mean. SPM 1st level is an extra step in the analysis, which models the response of one subject. The statistic generated () then taken forward to the

GLM. This A is possible because s are normally distributed. series of 3-D matrices ( values, error terms) Similarities between 1st & 2nd levels Both use the GLM model/tests and a similar SPM machinery Both produce design matrices. The columns in the design matrices represent explanatory variables: 1st level: All conditions within the experimental design 2nd level: The specific effects of interest The rows represent observations:

1st level: Time (condition onsets); within-subject variability 2nd level: subjects; between-subject variability Similarities between 1st & 2nd levels The same tests can be used in both levels (but the questions are different) .Con images: output at 1st level, both input and output at 2nd level There is typically only 1 1st-level design matrix per subject, but multiple 2nd level design matrices for the group one for each statistical test. Multiple 2 level analyses nd 1-sample t-tests:

Vowel vs. baseline [1 0] Tone vs. baseline [0 1] Vowel > Tone [1 -1] Vowel or tone >baseline [1 1] Vowel Tone Overview Fixed, random, and mixed models From 1st to 2nd level analysis 2nd level analysis: 1-sample t-test Masking Covariates 2nd level analysis: Paired t-test 2nd level analysis: 2-sample t-test 2nd level analysis: F-tests Multiple comparisons 1-Sample t-test

Enter 1 .con image per subject All subjects weighted equally all modeled with a 1 2nd level design matrix for 1-sample t-test The question: is mean activation significantly greater than zero? Y = data (parameter estimates) = 1*x + 0 1 Values from the design matrix Estimation and results 1-Sample t-test figures

These data (e.g. beta values) are available in the workspace useful to create more complex figures Statistical inference: imaging vs. behavioural data Inference of imaging data uses some of the same statistical tests as used for analysis of behavioral data: t-tests, ANOVA The effect of covariates for the study of individual-differences Some tests are more typical in imaging: Conjunction Multiple analysis

comparisons poses a greater problem in imaging Masking Implicit mask: the default, excluding voxels with NaN or 0 values Threshold masking: Images are thresholded at a given value and only voxels at which all images exceed the threshold Explicit mask: only user-defined voxels are included in the analysis Explicit masks Segmentation of structural images Single subject mask Group mask ROI mask

Covariates in 1-Sample t-test An additional regressor in the design matrix specifying subject-specific information (e.g. age). Nuisance covariates, covariate of interest: Included in the model in the same way. Nuisance: Contrast [1 0] focuses on mean, partialing out activation due to a variable of no interest Covariate of interest: contrast [0 1] focuses on the covariate. The parameter estimate represents the magnitude of correlation between task-specific activations and the subject-specific measure. Covariate options Entering single number

per subject. Centering: the vector will be meancorrected Covariate results Parameter estimate Slope: Parameter estimate of 2nd level covariate Mean activation Covariate Centred covariate mean Overview Fixed, random, and mixed models From 1st to 2nd level analysis 2nd level analysis: 1-sample t-test 2nd level analysis: Paired t-test 2nd level analysis: 2-sample t-test

2nd level analysis: F-tests Multiple comparisons Factorial design B2 B3 A1 1 2 3 A2 4 5 6

Firstback to first level analysis B1 here, 2 factors with 2/3 levels making 6 conditions For each subject we could create a number of effects of interest, eg. each condition separately each level separately contrast between levels within a factor interaction between factors [1,0,0,0,0,0,0] [1,1,1,0,0,0,0] [1,1,1,-1,-1,-1,0] [1,-1,0,-1,1,0,0] 123456 123456 123456 123456 Paired t-tests

This is when we start being interested in contrasts at 2nd level Within group between subject variance is greater than within subject variance better use of time to have more subjects for shorter scanning slots than vice versa Paired t-tests B2 B3 A1 1

2 3 A2 4 5 6 This is when we start being interested in contrasts at 2nd level Within group whether, across subjects, one effect of interest (A1) is significantly greater than another effect of interest (A2) contrast vector [1,-1] one-tailed / directional A1

B1 asks specific Q, eg. is A1>A2? You could equally do this same analysis by creating the contrast at the 1st level analysis and then running a one-sample t-test at the 2nd level A2 Factorial design B1 B2 B3 A1 1 2

3 A2 4 5 6 This is when we start being interested in contrasts at 2nd level Within group whether, across subjects, one effect of interest (A1) is significantly greater than another effect of interest (A2) contrast vector [1,1,1,-1,-1,-1] 123456 one-tailed / directional asks specific Q, eg. is A1>A2?

Factorial design B1 B2 B3 A1 1 2 3 A2 4 5 6

Conjunction analysis Simple example within group whether, across subjects, those voxels significantly activated in one contrast are also significantly activated in another eg. whether the difference between A1 and A2 is significant across all three conditions B1, B2 and B3 contrast vector ??? [1,1,1,-1,-1, -1] given [1,0,0,-1,0,0] & [0,1,0,0,-1,0] and [0,0,1,0,0,-1] basically testing whether there is a main effect in the absence of an interaction 123456 Overview Fixed,

random, and mixed models From 1st to 2nd level analysis 2nd level analysis: 1-sample t-test 2nd level analysis: Paired t-test 2nd level analysis: 2-sample t-test 2nd level analysis: F-tests Multiple comparisons Two sample t-tests This is a contrast again but cant be done at the 1st level of analysis this time Between both groups groups must have same design matrix Two sample t-tests

but cant be done at the 1st level Between groups B2 B3 A1 1 2 3 A2 4

5 6 B1 B2 B3 A1 1 2 3 A2 4 5 6

This is a contrast again B1 whether, across conditions, the difference between two groups of subjects (M & F) is significant one-tailed / directional asks specific Q, eg. is M>F? M F contrast vector [1,-1] Unlike the paired samples t-test, theres no other way to do this analysis as you havent been able to collapse data across subjects before Factorial design This B1

B2 B3 A1 1 2 3 A2 4 5 6 B1 B2 B3

A1 1 2 3 A2 4 5 6 is a contrast again but cant be done at the 1st level Between groups

whether, across conditions, the difference between two groups of subjects (M & F) is significant M F one-tailed / directional 123456 123456 asks specific Q, eg. is M>F? contrast vector [1,1,1,1,1,1,-1,-1,-1 ,-1 ,-1 ,-1] Overview Fixed, random, and mixed models From 1st to 2nd level analysis 2nd level analysis: 1-sample t-test 2nd level analysis: Paired t-test 2nd level analysis: 2-sample t-test 2nd level analysis: F-tests

Multiple comparisons F-tests This is for multiple contrasts Within and between groups whether, across conditions and/or subjects, a number of different contrasts are significant gives differences in both directions (+ve & -ve) equivalent to lots of 2-tailed t-test asks general question: A1 A2 contrast vector for main effect of A: [1,-1,0,0] [0,0,1,-1]

B1 B2 B3 A1 1 2 3 A2 4 5 6 B1 B2

B3 A1 1 2 3 A2 4 5 6 M F A1 A2 A1 A2 F-tests

This is for multiple contrasts Within and between groups whether, across conditions and/or subjects, a number of different contrasts are significant gives differences in both directions (+ve & -ve) equivalent to lots of 2-tailed t-test asks general question: A1 A2 contrast vector for main effect of A: [1,0,0,-1,0,0,0,0,0,0,0,0] [0,1,0,0,-1,0,0,0,0,0,0,0] [0,0,1,0,0,-1,0,0,0,0,0,0] [0,0,0,0,0,0,1,0,0,-1,0,0] [0,0,0,0,0,0,0,1,0,0,-1,0]

[0,0,0,0,0,0,0,0,1,0,0,-1] B1 B2 B3 A1 1 2 3 A2 4 5 6 B1

B2 B3 A1 1 2 3 A2 4 5 6 M F 123 456 123 456

F-tests This is for multiple contrasts Within and between groups whether, across conditions and/or subjects, a number of different contrasts are significant gives differences in both directions (+ve & -ve) equivalent to lots of 2-tailed t-test asks general question: M F contrast vector for main effect of sex: [1,0,0,1,0,0,0,0,0,0,0,0] [0,1,0,0,1,0,0,0,0,0,0,0] [0,0,1,0,0,1,0,0,0,0,0,0]

[0,0,0,0,0,0,-1,0,0,-1,0,0] [0,0,0,0,0,0,0,-1,0,0,-1,0] [0,0,0,0,0,0,0,0,-1,0,0,-1] B1 B2 B3 A1 1 2 3 A2 4 5 6

B1 B2 B3 A1 1 2 3 A2 4 5 6 M F

123 456 123 456 F-tests This is for multiple contrasts Within and between groups whether, across conditions and/or subjects, a number of different contrasts are significant gives differences in both directions (+ve & -ve) equivalent to lots of 2-tailed t-test asks general question: M(A1-A2) F(A1-A2) contrast vector for interaction between A and sex: [1,0,0,-1,0,0,0,0,0,0,0,0]

[0,1,0,0,-1,0,0,0,0,0,0,0] [0,0,1,0,0,-1,0,0,0,0,0,0] [0,0,0,0,0,0,-1,0,0,1,0,0] [0,0,0,0,0,0,0,-1,0,0,1,0] [0,0,0,0,0,0,0,0,-1,0,0,1] B1 B2 B3 A1 1 2 3 A2 4 5

6 B1 B2 B3 A1 1 2 3 A2 4 5 6 M

F 123456 123456 Overview Fixed, random, and mixed models From 1st to 2nd level analysis 2nd level analysis: 1-sample t-test 2nd level analysis: Paired t-test 2nd level analysis: 2-sample t-test 2nd level analysis: ANOVA Multiple comparisons Multiple comparisons were still doing these comparisons for each voxel involved in the analysis (even though weve collapsed across time) -> lots of comparisons also multiple contrasts problem of false positives correction for multiple comparisons cf talk on random field theory

References Previous MFD presentations SPM5 Manual, The FIL Methods Group (2007) Poline, Kherif, Pallier & Penny, Chapter 9, Statistical Parametric Mapping (2007) Penny & Holmes, Chapter 12, Human Brain function (2nd edition)