spm short course – oct. 2009 linear models and contrasts jean-baptiste poline neurospin, i2bm, cea...

46
SPM SPM short short course – course – Oct. Oct. 200 200 9 9 Linear Models Linear Models and and Contrasts Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

Upload: oliver-chambers

Post on 02-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SPM short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

SPM SPM short short course – course – Oct. Oct. 20020099Linear ModelsLinear Models and and ContrastsContrasts

Jean-Baptiste Poline

Neurospin, I2BM, CEASaclay, France

Page 2: SPM short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

……revisited : matrix formrevisited : matrix form

= + +

= + +Y

1 2 f(t)

Page 8: SPM short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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)

What if two conditions A and B are not of What if two conditions A and B are not of the same duration before convolution HRF?the same duration before convolution HRF?

Fact: model parameters depend on Fact: model parameters depend on regressors scalingregressors scaling

Page 10: SPM short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

What if we believe that there are drifts?What if we believe that there are drifts?

Page 11: SPM short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

Add more reference functions / covariates ...Add more reference functions / covariates ...

Discrete cosine transform basis functionsDiscrete cosine transform basis functions

Page 12: SPM short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

……design matrixdesign matrix

=

= +Y X

erro

r vec

tor

+

data v

ecto

r

Page 13: SPM short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

……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 short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 are estimated: let’s call them b

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

Page 16: SPM short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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?What if we have too many?

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.

Because the parameters depend on the scaling of the regressors Because the parameters depend on the scaling of the regressors included in the model, one should be careful in comparing included in the model, one should be careful in comparing manually entered regressors, or conditions of different durationsmanually entered regressors, or conditions of different durations

Page 17: SPM short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 + . . . b b b b b ....

Page 19: SPM short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

Convolution model

Design andcontrast

SPM(t) orSPM(F)

Fitted andadjusted data

Page 24: SPM short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 the sum of the squares of one or several combinations of F tests the sum of the squares of one or several combinations of the betasthe betas

in testing “single contrast” with an F test, for ex. b1 – b2, the in testing “single 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 short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

« Additional variance » : Again« Additional variance » : Again

No correlation between green red and yellow

Page 27: SPM short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

correlated regressors, for examplegreen: subject ageyellow: subject score

Testing for the green

Page 28: SPM short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

correlated contrasts

Testing for the red

Page 29: SPM short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

Very correlated regressors ?

Dangerous !

Testing for the green

Page 30: SPM short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

If significant ? Could be G or Y !

Testing for the green and yellow

Page 31: SPM short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

Completely correlated regressors ?

Impossible to test ! (not estimable)

Testing for the green

Page 32: SPM short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

An example: realAn example: real

Testing for first regressor: T max = 9.8

Page 33: SPM short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

Including the movement parameters in the Including the movement parameters in the modelmodel

Testing for first regressor: activation is gone !

Page 34: SPM short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

Modelling the interactionsModelling the interactions

Page 40: SPM short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

Thank you for your attention!Thank you for your attention!

[email protected]@cea.fr

Page 44: SPM short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France
Page 45: SPM short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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 46: SPM short course – Oct. 2009 Linear Models and Contrasts Jean-Baptiste Poline Neurospin, I2BM, CEA Saclay, France

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