# 02_GLM - Wellcome Trust Centre for Neuroimaging

```The General Linear Model
SPM for fMRI Course
Peter Zeidman
Methods Group
Wellcome Trust Centre for Neuroimaging
Overview
• Basics of the GLM
• Improving the model
• SPM files
http://www.fil.ion.ucl.ac.uk/~pzeidman/teaching/GLM.ppt
BASICS OF THE GLM
Image time-series
Realignment
Spatial filter
Design matrix
Smoothing
General Linear Model
Statistical Parametric Map
Statistical
Inference
Normalisation
Anatomical
reference Parameter estimates
RFT
p <0.05
A very simple fMRI experiment
One session
Passive word
listening
versus rest
7 cycles of
rest and listening
Blocks of 6 scans
with 7 sec TR
Question: Is there a change in the BOLD
response between listening and rest?
Modelling the measured data
Why?
How?
data
interest
1. Decompose data into effects and
error
2. Form statistic using estimates of
effects and error
linear
model
effects
estimate
error
estimate
statistic
Time
=1
BOLD signal
+ 2
x1
+
x2
y  x11  x2 2  e
error
Single voxel regression model
e
Mass-univariate analysis: voxel-wise GLM
p
1
1
1

p
y
N
=
N
X
y  X  e
e ~ N (0,  I )
2
+
N
e
Model is specified by
1. Design matrix X
N: number of scans
p: number of
regressors
The design matrix embodies all available knowledge about
experimentally controlled factors and potential confounds.
Voxel-wise time series analysis
Model
specification
Time
Parameter
estimation
Hypothesis
Statistic
BOLD signal
single voxel
time series
SPM
IMPROVING THE MODEL
What are the problems of this model?
1.
BOLD responses have a
delayed and dispersed form.
2.
The BOLD signal includes substantial amounts of
low-frequency noise (eg due to scanner drift).
3.
Due to breathing, heartbeat & unmodeled neuronal
activity, the errors are serially correlated. This violates
the assumptions of the noise model in the GLM
HRF
Problem 1: Shape of BOLD response
Solution: Convolution model
Expected BOLD
HRF
Impulses

=
t
f  g (t )   f ( ) g (t   )d
0
expected BOLD response
= input function impulse response function (HRF)
Convolution model of the BOLD response
Convolve stimulus function
with a canonical
hemodynamic response
function (HRF):
t
f  g (t )   f ( ) g (t   )d
0
 HRF
Problem 2: Low-frequency noise
Solution: High pass filtering
discrete cosine
transform (DCT)
set
blue =
black =
green =
account
red =
into
data
mean + low-frequency drift
predicted response, taking into
low-frequency drift
predicted response, NOT taking
account low-frequency drift
High pass filtering
discrete cosine
transform (DCT)
set
Problem 3: Serial correlations
et  aet 1   t with  t ~ N (0,  2 )
1st order autoregressive process: AR(1)
N
Cov(e)
autocovariance
function
N
Multiple covariance components
Ci   V
2
i
V    jQ j
ei ~ N (0, Ci )
enhanced noise model at voxel i
V
= 1
error covariance components Q
and hyperparameters 
Q1
+ 2
Q2
Estimation of hyperparameters  with ReML (Restricted Maximum Likelihood).
SPM FILES
1.Specify the model
1.Specify the model
SPM files (after specifying the model)
SPM.mat (after specifying the model)
SPM.xY – Filenames of
fMRI volumes
SPM.Sess – Per-session
experiment timing
SPM.xX – Design matrix
For documentation on these structures, type: help spm_spm
SPM.xX (Design matrix)
Design matrix
imagesc(SPM.xX.X);
SPM.xX (Design matrix)
Confounds (HPF)
imagesc(SPM.xX.K.X0);
2. Estimate the model
SPM files (after estimation)
SPM files (after estimation)
beta_0001.nii – beta_0004.nii
SPM files (after estimation)
ResMS.nii
Residual variance estimate
RPV.nii
Estimated RESELS per voxel
SPM files (after estimation)
SPM files (after contrast estimation)
Summary
1. We specify a general linear model of the data
2. The model is combined with the HRF, high-pass
filtered and serial correlations corrected
3. The model is applied to every voxel, producing
beta images.
4. Next we’ll compare betas to make inferences
http://www.fil.ion.ucl.ac.uk/~pzeidman/teaching/GLM.ppt
```