SPM course – May 2011 Linear Models – Contrasts
-
Upload
hedy-hoover -
Category
Documents
-
view
19 -
download
0
description
Transcript of SPM course – May 2011 Linear Models – Contrasts
![Page 1: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/1.jpg)
SPM course – SPM course – May 2011 May 2011 Linear ModelsLinear Models – – ContrastsContrasts
Jean-Baptiste Poline
Neurospin, I2BM, CEASaclay, France
![Page 2: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/2.jpg)
realignment &coregistration smoothing
normalisation
Corrected p-values
images Adjusted dataDesignmatrix
Anatomical Reference
Spatial filter
Random Field Theory
Your question:a contrast
Statistical MapUncorrected p-values
General Linear Model Linear fit
statistical image
![Page 3: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/3.jpg)
Make sure we understand the testing procedures : tMake sure we understand the testing procedures : t-- and F and F--teststests
PlanPlan
Examples – almost realExamples – almost real
REPEAT: model and fitting the data with a Linear ModelREPEAT: model and fitting the data with a Linear Model
But what do we test exactly ?But what do we test exactly ?
![Page 4: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/4.jpg)
Temporal series fMRI
Statistical image(SPM)
voxel time course
One voxel = One test (t, F, ...)One voxel = One test (t, F, ...)amplitude
time
General Linear Modelfittingstatistical image
![Page 5: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/5.jpg)
Regression example…Regression example…
= + +
voxel time series
90 100 110
box-car reference function
-10 0 10
90 100 110
Mean value
Fit the GLM
-2 0 2
![Page 6: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/6.jpg)
Regression example…Regression example…
= + +
voxel time series
90 100 110
box-car reference function
-2 0 2
0 1 2
Mean value
Fit the GLM
-2 0 2
![Page 7: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/7.jpg)
……revisited : matrix formrevisited : matrix form
= + +
= + +Y
1 2 f(t)
![Page 8: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/8.jpg)
Box car regression: design matrix…Box car regression: design matrix…
= +
= +Y X
data v
ecto
r
(v
oxel
time s
eries
)
design
mat
rix
param
eters
erro
r vec
tor
![Page 9: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/9.jpg)
Q: When do I care ?Q: When do I care ?
A: ONLY when comparing manually A: ONLY when comparing manually entered regressors (say you would like to entered regressors (say you would like to
compare two scores)compare two scores)
Fact: model parameters depend on Fact: model parameters depend on regressors scalingregressors scaling
careful when comparing two (or more) careful when comparing two (or more) manually entered regressors!manually entered regressors!
![Page 10: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/10.jpg)
What if we believe that there are drifts?What if we believe that there are drifts?
![Page 11: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/11.jpg)
Add more reference functions / covariates ...Add more reference functions / covariates ...
Discrete cosine transform basis functionsDiscrete cosine transform basis functions
![Page 12: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/12.jpg)
……design matrixdesign matrix
=
= +Y X
erro
r vec
tor
…
+
data v
ecto
r
![Page 13: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/13.jpg)
……design matrixdesign matrix
=
+
= +Y X
data v
ecto
r
design
mat
rix
param
eters
erro
r vec
tor
= the b
etas (
here :
1 to
9)
![Page 14: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/14.jpg)
Fitting the model = finding some Fitting the model = finding some estimateestimate of the of the betasbetas
raw fMRI time series adjusted for low Hz effects
residuals
fitted low frequencies
fitted signal
fitted drift
Raw data
How do we find the betas estimates? By How do we find the betas estimates? By minimizing the residual varianceminimizing the residual variance
![Page 15: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/15.jpg)
Fitting the model = finding some Fitting the model = finding some estimateestimate of the betas of the betas
=
+ Y = X
∥Y−X ∥2 = Σi [yi−X i ]2 finding the betas = finding the betas = minimising the sum of square of the minimising the sum of square of the residualsresiduals
when when are estimated: let’s call them b (or are estimated: let’s call them b (or ) )
when when is estimated : let’s call it e is estimated : let’s call it e
estimated SD of estimated SD of : let’s call it s : let’s call it s
^
Y = X b e
![Page 16: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/16.jpg)
We put in our model regressors (or covariates) that represent We put in our model regressors (or covariates) that represent how we think the signal is varying (of interest and of no interest how we think the signal is varying (of interest and of no interest alike) alike)
WHICH ONE TO INCLUDE ? WHICH ONE TO INCLUDE ? What if we have too many? Too few?What if we have too many? Too few?
Take home ...Take home ...
Coefficients (=Coefficients (= parameters) are parameters) are estimated by minimizing the estimated by minimizing the fluctuations, - variability – variance – of estimated noise – the fluctuations, - variability – variance – of estimated noise – the residuals. residuals.
![Page 17: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/17.jpg)
Make sure we understand t and F testsMake sure we understand t and F tests
PlanPlan
Make sure we all know about the estimation (fitting) part ...Make sure we all know about the estimation (fitting) part .... .
But what do we test exactly ?But what do we test exactly ?
An example – almost realAn example – almost real
![Page 18: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/18.jpg)
A contrast = a weighted sum of parameters: c´ bc’ = 1 0 0 0 0 0 0 0
divide by estimated standard deviation of b
T test - one dimensional contrasts - SPM{T test - one dimensional contrasts - SPM{tt}}
SPM{t}T =
contrast ofestimated
parameters
varianceestimate
T =
ss22c’(X’X)c’(X’X)--cc
c’bc’b
b > 0 ?
Compute 1xb + 0xb + 0xb + 0xb + 0xb + . . .= c’bc’b
c’ =c’ = [1 0 0 0 0 ….] [1 0 0 0 0 ….]
b b b b b ....
![Page 19: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/19.jpg)
From one time series to an imageFrom one time series to an image
Y: data +=voxels
scans
EBX *
c’ =
1 0
0 0
0 0
0 0
Var(E) = s2
T =
ss22c’(X’X)c’(X’X)--cc
c’bc’b =
spm_con??? imagesspm_con??? images
beta??? imagesbeta??? images
spm_t??? imagesspm_t??? images
spm_ResMSspm_ResMS
![Page 20: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/20.jpg)
FF--test : a reduced modeltest : a reduced model
H0: 1 = 0
X1 X0
H0: True model is X0
X0 c’ = 1 0 0 0 0 0 0 0
T values become F values. F = T2
Both “activation” and “deactivations” are tested. Voxel wise p-values are halved.This (full) model ? Or this one?
S2 S02
F ~ ( S02 - S2 ) / S2
![Page 21: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/21.jpg)
Tests multiple linear hypotheses : Does X1 model anything ?
FF--test : a reduced model or ...test : a reduced model or ...
This (full) model ?
H0: True (reduced) model is X0
X1 X0
S2
Or this one?
X0
S02 F =
errorvarianceestimate
additionalvariance
accounted forby tested
effects
F ~ ( S02 - S2 ) / S2
![Page 22: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/22.jpg)
0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 00 0 0 0 1 0 0 00 0 0 0 0 1 0 00 0 0 0 0 0 1 00 0 0 0 0 0 0 1
c’ =
tests multiple linear hypotheses. Ex : does drift functions model anything?
FF--test : a reduced model or ... multi-dimensional test : a reduced model or ... multi-dimensional contrasts ? contrasts ?
H0: 3-9 = (0 0 0 0 ...)
X1 X0
H0: True model is X0
X0
Or this one? This (full) model ?
![Page 23: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/23.jpg)
Convolution model
Design andcontrast
SPM(t) orSPM(F)
Fitted andadjusted data
![Page 24: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/24.jpg)
T tests are simple combinations of the betas; they are either T tests are simple combinations of the betas; they are either positive or negative (b1 – b2 is different from b2 – b1)positive or negative (b1 – b2 is different from b2 – b1)
T and F test: take home ...T and F test: take home ...
F tests can be viewed as testing for the additional variance F tests can be viewed as testing for the additional variance explained by a larger model wrt a simpler model, orexplained by a larger model wrt a simpler model, or
F tests is the square of one or several combinations of the betasF tests is the square of one or several combinations of the betas
in testing “simple contrast” with an F test, for ex. b1 – b2, the in testing “simple contrast” with an F test, for ex. b1 – b2, the result will be the same as testing b2 – b1. It will be exactly the result will be the same as testing b2 – b1. It will be exactly the square of the t-test, testing for both positive and negative effects.square of the t-test, testing for both positive and negative effects.
![Page 25: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/25.jpg)
Make sure we understand t and F testsMake sure we understand t and F tests
PlanPlan
Make sure we all know about the estimation (fitting) part ...Make sure we all know about the estimation (fitting) part .... .
But what do we test exactly ? Correlation between regressorsBut what do we test exactly ? Correlation between regressors
An example – almost realAn example – almost real
![Page 26: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/26.jpg)
« Additional variance » : Again« Additional variance » : Again
No correlation between green red and yellow
![Page 27: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/27.jpg)
correlated regressors, for examplegreen: subject ageyellow: subject score
Testing for the green
![Page 28: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/28.jpg)
correlated contrasts
Testing for the red
![Page 29: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/29.jpg)
Very correlated regressors ?
Dangerous !
Testing for the green
![Page 30: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/30.jpg)
If significant ? Could be G or Y !
Testing for the green and yellow
![Page 31: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/31.jpg)
Completely correlated regressors ?
Impossible to test ! (not estimable)
Testing for the green
![Page 32: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/32.jpg)
An example: realAn example: real
Testing for first regressor: T max = 9.8
![Page 33: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/33.jpg)
Including the movement parameters in the Including the movement parameters in the modelmodel
Testing for first regressor: activation is gone !Right or Wrong?
![Page 34: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/34.jpg)
Implicit or explicit Implicit or explicit ((decorrelation (or decorrelation (or orthogonalisation)orthogonalisation)
Implicit or explicit Implicit or explicit ((decorrelation (or decorrelation (or orthogonalisation)orthogonalisation)
YY
XbXb
ee
Space of XSpace of X
C1C1
C2C2
LC2 :
LC1:
test of C2 in the implicit model
test of C1 in the explicit model
C1C1C2C2
XbXb
LC1
LC2
C2C2
cf Andrade et al., NeuroImage, 1999
This generalises when testing several regressors (F tests)
![Page 35: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/35.jpg)
Correlation between regressors: take Correlation between regressors: take home ...home ...
Do we care about correlation in the design ? Do we care about correlation in the design ? Yes, alwaysYes, always
Start with the experimental design : conditions Start with the experimental design : conditions should be as uncorrelated as possibleshould be as uncorrelated as possible
use F tests to test for the overall variance use F tests to test for the overall variance explained by several (correlated) regressors explained by several (correlated) regressors
![Page 36: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/36.jpg)
Make sure we understand t and F testsMake sure we understand t and F tests
PlanPlan
Make sure we all know about the estimation (fitting) part ...Make sure we all know about the estimation (fitting) part .... .
But what do we test exactly ? Correlation between regressorsBut what do we test exactly ? Correlation between regressors
An example – almost realAn example – almost real
![Page 37: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/37.jpg)
A real example A real example (almost !)(almost !)
Factorial design with 2 factors : modality and category 2 levels for modality (eg Visual/Auditory)3 levels for category (eg 3 categories of words)
Experimental Design Design Matrix
V
A
C1
C2
C3C1
C2
C3
V A C1 C2 C3
![Page 38: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/38.jpg)
Asking ouAsking ourrselves some questions ...selves some questions ...V A C1 C2 C3
• Design Matrix not orthogonal • Many contrasts are non estimable• Interactions MxC are not modelled
Test C1 > C2 : c = [ 0 0 1 -1 0 0 ]Test V > A : c = [ 1 -1 0 0 0 0 ]
[ 0 0 1 0 0 0 ]Test C1,C2,C3 ? (F) c = [ 0 0 0 1 0 0 ] [ 0 0 0 0 1 0 ]
Test the interaction MxC ?
![Page 39: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/39.jpg)
Modelling the interactionsModelling the interactions
![Page 40: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/40.jpg)
V A V A V A
Test C1 > C2 : c = [ 1 1 -1 -1 0 0 0]
Test the interaction MxC :[ 1 -1 -1 1 0 0 0]
c = [ 0 0 1 -1 -1 1 0][ 1 -1 0 0 -1 1 0]
• Design Matrix orthogonal• All contrasts are estimable• Interactions MxC modelled• If no interaction ... ? Model is too “big” !
C1 C1 C2 C2 C3 C3
Test V > A : c = [ 1 -1 1 -1 1 -1 0]
Test the category effect :[ 1 1 -1 -1 0 0 0]
c = [ 0 0 1 1 -1 -1 0][ 1 1 0 0 -1 -1 0]
![Page 41: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/41.jpg)
With a more flexible modelWith a more flexible model
V A V A V ATest C1 > C2 ?Test C1 different from C2 ?from c = [ 1 1 -1 -1 0 0 0]to c = [ 1 0 1 0 -1 0 -1 0 0 0 0 0 0]
[ 0 1 0 1 0 -1 0 -1 0 0 0 0 0]becomes an F test!
C1 C1 C2 C2 C3 C3
What if we use only:
c = [ 1 0 1 0 -1 0 -1 0 0 0 0 0 0]
OK only if the regressors coding for the delay are all equal
![Page 42: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/42.jpg)
use F tests whenuse F tests when- Test for >0 and <0 effectsTest for >0 and <0 effects- Test for more than 2 levels in factorial Test for more than 2 levels in factorial designsdesigns- Conditions are modelled with more than one Conditions are modelled with more than one regressorregressor
Toy example: take home ...Toy example: take home ...
Check post hocCheck post hoc
![Page 43: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/43.jpg)
Thank you for your attention!Thank you for your attention!
[email protected] [email protected] [email protected] [email protected]
![Page 44: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/44.jpg)
Px Y = X
![Page 45: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/45.jpg)
Projector onto XProjector onto X
![Page 46: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/46.jpg)
![Page 47: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/47.jpg)
![Page 48: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/48.jpg)
![Page 49: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/49.jpg)
654111095432654
3218765431321
)6(11526
)5(10425
)4(9324
)3(8513
)2(7412
)1(6311
3
3
yyy
yyy
y
y
y
y
y
y
![Page 50: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/50.jpg)
How is this computed ? (t-test)How is this computed ? (t-test)
YY = = X X + + ~ ~ N(0,I) N(0,I) (Y : at one position)(Y : at one position)
b = (X’X)b = (X’X)+ + X’Y X’Y (b(b: : estimatestimatee of of ) -> ) -> beta??? images beta??? images
e = Y - Xbe = Y - Xb (e(e:: estimat estimatee of of ))
ss22 = (e’e/(n - p)) = (e’e/(n - p)) (s(s:: estimat estimate of e of n: n: time pointstime points, p: param, p: parameterseters)) -> -> 1 image ResMS1 image ResMS
Estimation [Y, X] [b, s]
Test [b, s2, c] [c’b, t]
Var(c’b) Var(c’b) = s= s22c’(X’X)c’(X’X)++c c (compute for each contrast c, proportional to (compute for each contrast c, proportional to ss22))
t = c’b / sqrt(st = c’b / sqrt(s22c’(X’X)c’(X’X)++c) c) c’b -> c’b -> images spm_con???images spm_con???
compute the t images -> compute the t images -> images spm_t??? images spm_t???
under the null hypothesis Hunder the null hypothesis H00 : t ~ Student : t ~ Student-t-t( df ) df = n-p( df ) df = n-p
![Page 51: SPM course – May 2011 Linear Models – Contrasts](https://reader035.fdocuments.us/reader035/viewer/2022062517/56812f90550346895d950d49/html5/thumbnails/51.jpg)
How is this computed ? (F-test)How is this computed ? (F-test)Error
varianceestimate
additionalvariance accounted for
by tested effects
Test [b, s, c] [ess, F]
F ~ (sF ~ (s0 0 - s) / s- s) / s2 2 -> image -> image spm_ess???spm_ess???
-> image of F : -> image of F : spm_F???spm_F???
under the null hypothesis : F ~ F(under the null hypothesis : F ~ F(p - p0p - p0, n-p), n-p)
Estimation [Y, X] [b, s]
YY == X X + + ~ N(0, ~ N(0, I) I)
YY == XX + + ~ N(0, ~ N(0, I) I) XX : X Reduced : X Reduced