the general linear model (for dummies…) carmen tur and ashwani jha 2009

54
The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

Upload: evelyn-sparks

Post on 06-Jan-2018

218 views

Category:

Documents


2 download

DESCRIPTION

What is the GLM? It is a model (ie equation) It provides a framework that allows us to make refined statistical inferences taking into account: – the (preprocessed) 3D MRI images – time information (BOLD time series) – user defined experimental conditions – neurobiologically based priors (HRF) – technical / noise corrections

TRANSCRIPT

Page 1: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

The General Linear Model (for dummies…)

Carmen Tur and Ashwani Jha 2009

Page 2: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

Overview of SPM

RealignmentRealignment SmoothingSmoothing

NormalisationNormalisation

General linear modelGeneral linear model

Statistical parametric map (SPM)Statistical parametric map (SPM)Image time-seriesImage time-series

Parameter estimatesParameter estimates

Design matrixDesign matrix

TemplateTemplate

KernelKernel

Gaussian Gaussian field theoryfield theory

p <0.05p <0.05

StatisticalStatisticalinferenceinference

Page 3: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

What is the GLM?

• It is a model (ie equation)• It provides a framework that allows us to

make refined statistical inferences taking into account:– the (preprocessed) 3D MRI images– time information (BOLD time series)– user defined experimental conditions– neurobiologically based priors (HRF)– technical / noise corrections

Page 4: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

How does work?

• By creating a linear model:

Collect Data

X

Y

Data

Page 5: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

How does work?

• By creating a linear model:

Collect Data

Generate model

X

Y

Data

Y=bx + c

Page 6: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

How does work?

• By creating a linear model:

Collect Data

Generate model

Fit model

X

Y

Data

Y=0.99x + 12 + e

e

N

tte

1

2 = minimum

Page 7: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

How does work?

• By creating a linear model:

Collect Data

Generate model

Fit model

Test modelX

Y

Data

Y=0.99x + 12 + e

e

Page 8: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

GLM matrix format

Y = β1 X1 + C + e 5.9 1 2 15.0 2 0 18.4 3 5 12.3 4 4 24.7 5 8 23.2 6 8 19.3 7 0 13.6 8 9 26.1 9 1 21.6 10 5 31.7 11 2

• But GLM works with lists of numbers (matrices)

Y = 0.99x + 12 + e

Page 9: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

GLM matrix format

• But GLM works with lists of numbers (matrices)

Y = β1 X1 + β2 X2 + C + e 5.9 1 2 15.0 2 2 18.4 3 5 12.3 4 5 24.7 5 5 23.2 6 2 19.3 7 2 13.6 8 5 26.1 9 5 21.6 10 5 31.7 11 2

Y = 0.99x + 12 + e

‘non-linear’We need to put this in… (data Y, and design matrix Xs)

sphericity assumption

Page 10: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

GLM matrix format

=

e+y X

N

1

N N

1 1p

p

eXy ),0(~ 2INe

Page 11: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

fMRI example (from SPM course)…

Page 12: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

Passive word listeningversus rest7 cycles of rest and listeningBlocks of 6 scanswith 7 sec TR

Question: Is there a change in the BOLD response between listening and rest?

Stimulus function

One sessionA very simple fMRI experiment

Page 13: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

Time

BOLD signal

Time

A closer look at the data (Y)…

Look at each voxel over time (mass univariate)

Page 14: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

BOLD signal

Time = + erro

r

e

2+

x2

1

x1

The rest of the model…

exxy 2211

Instead of C

Page 15: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

The GLM matrix format

eXy

= +

e

2

1

y X

),0(~ 2INe

Page 16: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

…easy!

• How to solve the model (parameter estimation)

• Assumptions (sphericity of error)

Page 17: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

• Actually try to estimate

• ‘best’ has lowest overall error ie the sum of squares of the error:

• But how does this apply to GLM, where X is a matrix…

^

Solving the GLM (finding )

Y=0.99x + 12 + e

e

N

tte

1

2 = minimum

^

Page 18: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

…need to geometrically visualise the GLM in N dimensions

= +

e

2

1

y x1 x2

N

^

^

Page 19: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

…need to geometrically visualise the GLM

031

01

2

121

= +e

2

1

y x1 x2

N=3

x2

x1

Design space defined by y = X

^

^^What about the actual data y?

Page 20: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

…need to geometrically visualise the GLM

= +e

2

1

y x1 x2

N=3

x2

x1

Design space defined by y = X

^

^^

y

031

01

2

121

Page 21: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

Once again in 3D..

• The design (X) can predict the data values (y) in the design space.

• The actual data y, usually lies outside this space.

• The ‘error’ is difference.

ye

Design space defined by X

x1

x2 ̂ˆ Xy

^

eXy

Page 22: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

Solving the GLM (finding ) – ordinary least squares (OLS)

• To find minimum error:

• e has to be orthogonal to design space (X). “Project data onto model”

• ie: XTe = 0XT(y - X) = 0 XTy = XTX

eXy

ye

Design space defined by X

x1

x2 ̂ˆ Xy

N

tte

1

2 = minimum

yXXX TT 1)(ˆ eXy

Page 23: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

Assuming sphericity

• We assume that the error has:– a mean of 0, – is normally distributed– is independent (does not

correlate with itself)

),0(~ 2INe

e

526

97

51

21

e

=

e

frequency

Page 24: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

Assuming sphericity

• We assume that the error has:– a mean of 0, – is normally distributed– is independent (does not

correlate with itself)

),0(~ 2INe

e

526

97

51

21

e

=te

1te

x

Page 25: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

Solution

Half-way re-cap…

eXy

= +

e

2

1

Ordinary least squares

estimation (OLS) (assuming i.i.d.

error):yXXX TT 1)(ˆ

y X

GLM

Page 26: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

GLM

Methods for dummies 2009-10London, 4th November 2009

II partCarmen Tur

Page 27: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

I. BOLD responses have a delayed and dispersed form

HRF

Neural stimulus hemodynamic response

time

Neural stimulus

Hemodynamic Response Function: This is the expected BOLD signal if a neural stimulus takes place

expected BOLD response = input function impulse response function (HRF)

expected BOLD

response

Problems of this model

Page 28: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

I. BOLD responses have a delayed and dispersed form Solution: CONVOLUTION

HRF

Transform neural stimuli function into a expected BOLD signal with a canonical hemodynamic response function (HRF)

t

dtgftgf0

)()()(

Problems of this model

Page 29: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

II. The BOLD signal includes substantial amounts of low-frequency noise

Problems of this model

WHY? Multifactorial: biorhythms, coil heating, etc…

HOW MAY OUR DATA LOOK LIKE?

IntensityOf BOLD signal

Time

Real dataPredicted response, NOT taking into account low-frequency drift

Page 30: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

II. The BOLD signal includes substantial amounts of low-frequency noise

Problems of this model

Solution: HIGH PASS FILTERING

discrete cosine

transform (DCT) set

Page 31: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

STEPS so far…Interim summary: GLM so far…

1. Acquisition of our data (Y)2. Design our matrix (X)3. Assumptions of GLM 4. Correction for BOLD signal shape: convolution5. Cleaning of our data of low-frequency noise6. Estimation of βs

But our βs may still be wrong! Why?

7. Checkup of the error… Are all the assumptions of the error satisfied?

Page 32: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

III. The data are serially correlated Temporal autocorrelation:

in y = Xβ + e over time

0

It is…

t

e

e in time t is correlated with e in time t-1

Problems of this model

It should be…

0 t

e

Page 33: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

III. The data are serially correlated Temporal autocorrelation:

in y = Xβ + e over time

WHY? Multifactorial…

Problems of this model

Page 34: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

III. The data are serially correlated Temporal autocorrelation:

in y = Xβ + e over timeet = aet-1 + ε (assuming ε ~ N(0,σ2I))

Problems of this model

autocovariance function

Autoregressive model

in other words: the covariance of error at time t (et) and error at

time t-1 (et-1) is not zero

Page 35: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

III. The data are serially correlated Temporal autocorrelation:

in y = Xβ + e over timeet = aet-1 + ε (assuming ε ~ N(0,σ2I))

Problems of this model

Autoregressive model

et = aet-1 + ε

et = a (aet-2 + ε) + ε et = a2et-2 + aε + ε

et = a2(aet-3 + ε) + aε + ε et = a3et-3 + a2ε + aε + ε…

et -1= aet-2 + εet -2= aet-3 + ε…

But a is a number between 0 and 1

Page 36: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

Problems of this model

in other words: the covariance of error at time t (et) and error at time t-1

(et-1) is not zero

time (scans)

time(scans)

ERROR:Covariance

matrix

1 2 3 4 5 6 7 8 9 101

2

3

4

5

6

7

8

9

10

Page 37: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

III. The data are serially correlated Temporal autocorrelation:

in y = Xβ + e over timeet = aet-1 + ε (assuming ε ~ N(0,σ2I))

autocovariance function

Problems of this model

Autoregressive model

This violates the assumption of the error e ~ N (0, σ2I)

in other words: the covariance of error at time t (et) and error at

time t-1 (et-1) is not zero

Page 38: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

III. The data are serially correlated Solution:

1. Use an enhanced noise model with hyperparameters for multiple error covariance components

Problems of this model

It should be… It is…

et = aet-1 + εa ≠ 0 a = 0

et = aet-1 + εet = ε But…a? ?

et = εOr, if you

wish

Page 39: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

III. The data are serially correlated Solution:

1. Use an enhanced noise model with hyperparameters for multiple error covariance components

Problems of this model

It should be… It is…

et = aet-1 + εa ≠ 0 a = 0

et = aet-1 + εet = ε But…a? ?

We would like to know covariance (a, autocovariance) of error

But we can only estimate it: V V = Σ λiQ i

V = λ1Q1 + λ2Q 2 λ1 and λ2:

hyperparameters

Q1 and Q2: multiple error covariance

components

Page 40: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

III. The data are serially correlated Solution:

1. Use an enhanced noise model with hyperparameters for multiple error covariance components 2. Use estimated autocorrelation to specify filter matrix W for whitening the data

et = aet-1 + ε (assuming ε ~ N(0,σ2I))

WY = WXβ + We

Problems of this model

Page 41: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

Other problems – Physiological confounds

• head movements

• arterial pulsations (particularly bad in brain stem)

• breathing

• eye blinks (visual cortex)

• adaptation affects, fatigue, fluctuations in concentration, etc.

Page 42: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

Other problems – Correlated regressors

Example: y = x1β1 + x2β2 + e

When there is high (but not perfect) correlation between regressors, parameters can be estimated… But the estimates will

be inefficiently estimated (ie highly variable)

Page 43: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

• HRF varies substantially across voxels and subjects

• For example, latency can differ by ± 1 second

• Solution: MULTIPLE BASIS FUNCTIONS (another talk)

Other problems – Variability in the HRF

HRF could be understood as a linear combination of A, B and C

A

BC

Page 44: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

Model everythingImportant to model all known

variables, even if not experimentally interesting:

effects-of-interest (the regressors we are actually interested in)

+head movement, block and subject

effects…

subjects

globalactivity or movementconditions:

effects of interest

Ways to improve the model

Minimise residual error variance

Page 45: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

• The aim of modelling the measured data was to make inferences about effects of interest

• Contrasts allow us to make such inferences

• How? T-tests and F-tests

How to make inferences

REMEMBER!!

Another talk!!!

Page 46: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

Using an easy example...

SUMMARY

Page 47: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

Given data (image voxel, y)

Y = X . β + ε

Page 48: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

Different (rigid and known) predictors (regressors, design matrix, X)

x1

x2

x3

x4

x5

x6 Time

Y = X . β + ε

Page 49: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

Fitting our models into our data (estimation of parameters, β)

x1 x2 x3 x4 x5 x6

Y = X . β + εY = X . β + ε

Page 50: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

Y = X . β + ε HOW?

Fitting our models into our data (estimation of parameters, β)

Minimising residual error variance

Page 51: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

Minimising residual error variance

e (error) = yo - ye

Minimising the Sums of Squares of the Error differences between your predicted model and the observed data

Page 52: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

y = x16 + x23+ x31+ x42+ x51+ x636 + e

Y = X . β + ε

Fitting our models into our data (estimation of parameters, β)

y = x1β1 + x2β2 + x3β3 + x4β4 + x5β5 + x6β6 + e

We must pay attention to the problems that the GLM has…

Page 53: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

Y = X . β + ε

Making inferences:our final goal!!

The end

Page 54: The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009

REFERENCES1. Talks from previous years2. Human brain function

THANKS TO GUILLAUME FLANDIN

Many thanks for your attentionLondon 4th Nov 2009

GENERAL LINEAR MODEL – Methods for Dummies 2009-2010