450 likes | 464 Views
Learn about fixed, random, and mixed models in 2nd level analysis, including 1-sample t-test, paired t-test, 2-sample t-test, F-tests, and multiple comparisons.
E N D
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 effect: A variable with fixed values • E.g. levels of an experimental variable. • Random effect: A variable with values that can vary. • 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 Experimental conditions • 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. Constants Regressors Covariates S1 S2 S3 S4 S5
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 within- and 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, one design matrix per subject • Define 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.
1st level X values • 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. Convolved with HRF
1st level parameter estimate 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 Tone - baseline 1 1 Vowel beta =23.356 Tone beta2 =14.4169 .con =8.9309 Vowel =23.356 .con =23.356
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 is possible because βs are normally distributed. • A 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 2nd level analyses • 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 Values from the design matrix 1
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 analysis • Multiple 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.
Entering single number per subject. Centering: the vector will be mean- corrected Covariate options
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
[1,0,0,0,0,0,0] [1,1,1,0,0,0,0] [1,1,1,-1,-1,-1,0] 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 B1 B2 B3 Factorial design A1 1 2 3 A2 4 5 6 • First…back to first level analysis • 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,-1,0,-1,1,0,0]
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
B1 B2 B3 Paired t-tests 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 • asks specific Q, eg. is A1>A2? • You could equally do this same analysis bycreating the contrast at the 1st level analysisand then running a one-sample t-test at the2nd level A1 A2
B1 B2 B3 Factorial design 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] • one-tailed / directional • asks specific Q, eg. is A1>A2? 1 2 3 4 5 6
B1 B2 B3 Factorial design 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 maineffect in the absence of an interaction 1 2 3 4 5 6
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 can’t be done at the 1st level of analysis this time • Between groups • both groups must have same design matrix
B1 B2 B3 Two sample t-tests A1 1 2 3 A2 4 5 6 • This is a contrast again • but can’t be done at the 1st level • Between groups • whether, across conditions, the difference between two groups of subjects (M & F) is significant • one-tailed / directional • asks specific Q, eg. is M>F? • contrast vector [1,-1] • Unlike the paired samples t-test, there’s noother way to do this analysis as you haven’tbeen able to collapse data across subjectsbefore B1 B2 B3 A1 1 2 3 A2 4 5 6 M F
B1 B2 B3 Factorial design A1 1 2 3 A2 4 5 6 • This is a contrast again • but can’t be done at the 1st level • Between groups • whether, across conditions, the difference between two groups of subjects (M & F) is significant • one-tailed / directional • asks specific Q, eg. is M>F? • contrast vector[1,1,1,1,1,1,-1,-1,-1 ,-1 ,-1 ,-1] 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: F-tests • Multiple comparisons
B1 B2 B3 F-tests A1 1 2 3 A2 4 5 6 • This is for multiple contrasts • Within and between groups • whether, across conditions and/orsubjects, a number of differentcontrasts 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 M F A1 A2 A1 A2
B1 B2 B3 F-tests A1 1 2 3 A2 4 5 6 • This is for multiple contrasts • Within and between groups • whether, across conditions and/orsubjects, a number of differentcontrasts 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 M F 123 456 123 456
B1 B2 B3 F-tests A1 1 2 3 A2 4 5 6 • This is for multiple contrasts • Within and between groups • whether, across conditions and/orsubjects, a number of differentcontrasts 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 M F 123 456 123 456
B1 B2 B3 F-tests A1 1 2 3 A2 4 5 6 • This is for multiple contrasts • Within and between groups • whether, across conditions and/orsubjects, a number of differentcontrasts 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 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 • we’re still doing these comparisons for each voxel involved in the analysis (even though we’ve 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)