The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009.
-
Upload
evelyn-sparks -
Category
Documents
-
view
218 -
download
2
description
Transcript of The General Linear Model (for dummies…) Carmen Tur and Ashwani Jha 2009.
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
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
How does work?
• By creating a linear model:
Collect Data
X
Y
Data
How does work?
• By creating a linear model:
Collect Data
Generate model
X
Y
Data
Y=bx + c
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
How does work?
• By creating a linear model:
Collect Data
Generate model
Fit model
Test modelX
Y
Data
Y=0.99x + 12 + e
e
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
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
GLM matrix format
=
e+y X
N
1
N N
1 1p
p
eXy ),0(~ 2INe
fMRI example (from SPM course)…
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
Time
BOLD signal
Time
A closer look at the data (Y)…
Look at each voxel over time (mass univariate)
BOLD signal
Time = + erro
r
e
2+
x2
1
x1
The rest of the model…
exxy 2211
Instead of C
The GLM matrix format
eXy
= +
e
2
1
y X
),0(~ 2INe
…easy!
• How to solve the model (parameter estimation)
• Assumptions (sphericity of error)
• 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
^
…need to geometrically visualise the GLM in N dimensions
= +
e
2
1
y x1 x2
N
^
^
…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?
…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
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
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
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
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
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
GLM
Methods for dummies 2009-10London, 4th November 2009
II partCarmen Tur
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
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
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
II. The BOLD signal includes substantial amounts of low-frequency noise
Problems of this model
Solution: HIGH PASS FILTERING
discrete cosine
transform (DCT) set
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?
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
III. The data are serially correlated Temporal autocorrelation:
in y = Xβ + e over time
WHY? Multifactorial…
Problems of this model
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
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
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
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
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
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
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
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.
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)
• 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
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
• 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!!!
Using an easy example...
SUMMARY
Given data (image voxel, y)
Y = X . β + ε
Different (rigid and known) predictors (regressors, design matrix, X)
x1
x2
x3
x4
x5
x6 Time
Y = X . β + ε
Fitting our models into our data (estimation of parameters, β)
x1 x2 x3 x4 x5 x6
Y = X . β + εY = X . β + ε
Y = X . β + ε HOW?
Fitting our models into our data (estimation of parameters, β)
Minimising residual error variance
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
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…
Y = X . β + ε
Making inferences:our final goal!!
The end
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