2nd level analysis – design matrix, contrasts and inference alexander leff

42
2nd level analysis – design matrix, contrasts and inference Alexander Leff

Upload: sheldon-head

Post on 31-Mar-2015

224 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

2nd level analysis – design matrix, contrasts and inference

Alexander Leff

Page 2: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

Overview

• Why do 2nd-level analyses?

• Image based view of spm stats.

• Practical examples of 2nd level design matrices.

• Correction for multiple comparisons.

Page 3: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

2nd Level inference

Study Group

Sample Group

InferenceSampling

In order for inferences to be valid about the study group (the population you want you findings to pertain to), the sample population (those who you actually study) should be representatively drawn from the study population.

Page 4: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

Theoretical basis for 2nd level analyses

• Depends on whether you want to generalize your findings beyond the subjects you have studied (sample group).

• Usually this is the case, however:– Karl’s ‘talking dog’.– In a human, this happens: In humans, this happens.– In this group of patients… : In patients…

Page 5: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

1st level design matrix:6 sessions per subject

Page 6: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

15 auditory contrasts 2 target contrasts 6 movement parameters

A B

A = convolved with HRFB = not convolved with HRF

Betas are calculated for each column of the design matrix 23 betas x 6 sessions = 138 + 6 constants = 144 beta images.

Data, Y

A regressor, X, = timeseries of expected activation.

Y = X + e

Page 7: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

The following images are created each time an analysis is performed (1st or 2nd level)

• beta images (with associated header), images of estimated regression coefficients (parameter estimate). Combined to

produce con. images.• mask.img This defines the search space for the

statistical analysis.• ResMS.img An image of the variance of the

error (NB: this image is used to produce spmT images).

• RPV.img The estimated resels per voxel (not currently used).

Page 8: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

1st-level (within-subject)

1

2

3

4

5

6

1

^

^

^

^

^

^

wwithin-subject error^

Beta images contain values related to size of effect. A given voxel in each beta image will have a value related to the size of effect for that explanatory variable.

The ‘goodness of fit’ or error term is contained in the ResMS file and is the same for a given voxel within the design matrix regardless of which beta(s) is/are being used to create a con.img.

Design efficiency

Page 9: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

Mask.imgCalculated using the intersection of 3 masks: 1) user specified, 2) Implicit (if a zero in any image then masked for all images) default = yes, 3) Thresholding which can be i) none, ii) absolute, iii) relative to global (80%).

Page 10: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

Specify this contrastfor each session

Page 11: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

Contrast 1:Vowel - baseline

Page 12: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

Beta value = % change above global mean.In this design matrix there are 6 repetitions of the condition so these need to be summed.

Con. value = summation of all relevant betas.

Page 13: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

ResMS.img =residual sum of squares or variance image and is a measure of within-subject error at the 1st level or between-subject error at the 2nd.

Con. value is combined with ResMS value at that voxel to produce a T statistic or spm.T.img.

2ˆi

Page 14: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

spmT.imgThresholded using theresults button.

Eg random noiseEg random noise

Gaussian10mm FWHM(2mm pixels)

pu = 0.05

Gaussian10mm FWHM(2mm pixels)

pu = 0.05pu = 0.05

Page 15: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

spmT.img and corresponding spmF.img

Page 16: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

]c[

]c[

]c[ ]c[

ConX)(XCon ˆ]c[

voxel@ sMSReˆ1-TT2

2

i

i

ii

ii

ii

stdt

Varstd

Var

ci = voxel value in contrast image at voxel iCon = contrast applied to design matrix

Page 17: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

]c[

]c[

]c[ ]c[

ConX)(XCon ˆ]c[

voxel@ sMSReˆ1-TT2

2

i

i

ii

ii

ii

stdt

Varstd

Var

ci = voxel value in contrast image at voxel iConT = contrast applied to design matrixC = Constant term

Page 18: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

]c[

]c[

]c[ ]c[

ConX)(XCon ˆ]c[

voxel@ sMSReˆ1-TT2

2

i

i

ii

ii

ii

stdt

Varstd

Var

ci = voxel value in contrast image at voxel iConT = contrast applied to design matrixC = Constant term

Efficiency termContrast specific(See Tom Jenkins’/Paul Bentley’s slides).

Page 19: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

]c[

]c[

]c[ ]c[

ConX)(XCon ˆ]c[

voxel@ sMSReˆ1-TT2

2

i

i

ii

ii

ii

stdt

Varstd

Var

ci = voxel value in contrast image at voxel iConT = contrast applied to design matrixC = Constant term

Page 20: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

]c[

]c[

]c[ ]c[

ConX)(XCon ˆ]c[

voxel@ sMSReˆ1-TT2

2

i

i

ii

ii

ii

stdt

Varstd

Var

ci = voxel value in contrast image at voxel iConT = contrast applied to design matrixC = Constant term

Page 21: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

Summary

• beta images contain information about the size of the effect of

interest.

• Information about the error variance is held in the ResMS.img.

• beta images are linearly combined to produce relevant con.

images.

• The design matrix, contrast, constant and ResMS.img are subjected

to matrix multiplication to produce an estimate of the st.dev.

associated with each voxel in the con.img.

• The spmT.img are derived from this and are thresholded in the

results step.

Page 22: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

Contrast 2:Vowel - Tones

Page 23: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

Vowel - baseline Tone - baseline Vowel - ToneVowel – baseline

Contrast images for the two classes of stimuli versus baseline and versus each other(linear summation of all relevant betas)

Page 24: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

Vowel - baseline Tone - baseline Vowel - Tone

spmT images for the two classes of stimuli versus baseline and versus each other(these are not linearly related as the st.dev. of the voxel value in each con.img varies with each contrast).

Page 25: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

2nd level analysis – what’s different?• Maths is identical.• Con.img at the first level are output files, at the second level

they are both input and output files.• 1st level: variance is within subject, 2nd level: variance is

between subject.• Different types of design matrix (3 examples).

Page 26: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

Specify 2nd level: One-sample t-testSimplest example, most parsimonious.

Page 27: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

NB: Mask file will only include voxels common to all subjects.

Group mask Single subject mask

Page 28: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

Estimate:

Results:Vowel – Tone contrast.

Page 29: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

NB: beta and con images are identical.

beta.img con.img

Page 30: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

Plot from voxel shows error variance.spmT.img

Page 31: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

Specify 2nd level: Full factorialMore than one contrast per subject, can cause a problem with sphericity assumptions.Can analyse systematically: simple main effects then interactions.Mask one contrast with another etc.

Vowels Formants Tones

Page 32: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

Specify 2nd level: One-sample t-testSimplest example, most parsimonious

Page 33: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

Test with a conjunction term:Which voxels are activated in both contrasts

Vowels Formants TonesPlot:

Page 34: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

Specify 2nd level: One sample t-testwith a covariate added.Test correlations between task specific activations and some other measure(age, performance, etc.).

Vectors added here.Needs to be mean corrected by hand.(in this case age squaredthen mean corrected).

Page 35: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

Main effect of grip (1st level analysis event related Correlation between grip and age of subjectdesign: grip vs. rest)

Page 36: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

This plot correlates betas related to grip (y-axis) with a measure of age (x-axis)

Page 37: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

2nd level analysis summary

• Many different ways of entering the contrast images of

interest generated by the first level design matrix.

• Choice depends primarily on:

1. Initial study design.

2. Parsimonious models vs. more complex ones.

Page 38: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

Voxels = volume/8: FDR-corr

Resels = calculated from the estimated smoothness (FWHM): FEW-corr

volume = defined by mask.img

Page 39: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

Small volume correction: box, sphere, image.

Page 40: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

Canonical 152 T1.img STG mask (created in MRIcro. NB: must reorient origin in spm).

Page 41: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

SVC summary

• p value associated with t and Z scores is dependent on 2

parameters:

1. Degrees of freedom.

2. How you choose to correct for multiple comparisons.

Page 42: 2nd level analysis – design matrix, contrasts and inference Alexander Leff

Sources

• Rik Henson’s slides.

• MfD past and present.

• SPM manual (D:\spm5\man).

• Will Penny.