Sunteți pe pagina 1din 31

General Linear

Model

Beatriz Calvo
Davina Bristow
Overview
Summary of regression
Matrix formulation of multiple regression
Introduce GLM
Parameter Estimation
Residual sum of squares
GLM and fMRI
fMRI model
Linear Time Series
Design Matrix
Parameter estimation
Summary
Summary of Regression
Linear regression models the linear relationship between a
single dependent variable, Y, and a single independent
variable, X, using the equation:

Y = X + c +

The regression coefficient, , reflects how much of an


effect X has on Y

is the error term and is assumed to be independently,


identically, and normally distributed (mean 0 and variance
2)
Summary of Regression
Multiple regression is used to determine the effect of a
number of independent variables, X1, X2, X3 etc, on a
single dependent variable, Y
The different X variables are combined in a linear way and
each has its own regression coefficient:

Y = 1X1 + 2X2 +..+ LXL +

The parameters reflect the independent contribution of


each independent variable, X, to the value of the
dependent variable, Y.
i.e. the amount of variance in Y that is accounted for by
each X variable after all the other X variables have been
accounted for
Matrix formulation

Multiplying matrices reminder:

abc x G =
Gxa+Hxb+Ixc
def H
I Gxd+Hxe+Ixf
Matrix Formulation
Write out equation for each observation of variable Y from 1 to J:

Y1 = X111 ++X1ll ++ X1LL + 1

Yj = Xj11 ++Xjll ++ XjLL + j

YJ = XJ11 ++XJll ++ XJLL + J

Can turn these simultaneous equations into matrix form to get a single
equation:

Y1 X11 X1l X1L 1 1


Yj = Xj1 X1l X1L j + j
YJ X11 X1l X1L J J

Y = X x +
Observed data Design Matrix Parameters Residuals/Error
General Linear Model
This is simply an extension of multiple regression

Or alternatively Multiple Regression is just a simple form


of the General Linear Model

Multiple Regression only looks at ONE dependent (Y)


variable

Whereas, GLM allows you to analyse several


dependent, Y, variables in a linear combination

i.e. multiple regression is a GLM with only one Y variable

ANOVA, t-test, F-test, etc. are also forms of the GLM


GLM - continued..
In the GLM the vector Y, of J observations of a single Y
variable, becomes a MATRIX, of J observations of N
different Y variables

An fMRI experiment could be modelled with matrix Y of


the BOLD signal at N voxels for J scans

However SPM takes a univariate approach, i.e. each


voxel is represented by a column vector of J fMRI signal
measurements, and it processed through a GLM
separately

(this is why you then need to correct for multiple


comparisons)
GLM and fMRI
How does the GLM apply to fMRI experiments?

Y = X . +
Observed data: Design matrix: Parameters: Error:

SPM uses a mass Several components which Define the Difference


univariate explain the observed data, i.e. contribution of each between the
approach that is the BOLD time series for the component of the observed
each voxel is voxel design matrix to the data, Y, and
treated as a Timing info: onset vectors, value of Y that predicted
separate column Omj, and duration vectors, Dmj Estimated so as to by the model,
vector of data. HRF, hm, describes shape of minimise the error, , X .
Y is the BOLD the expected BOLD response i.e. least sums of Not assumed
signal at various over time squares to be spherical
time points at a Other regressors, e.g. in fMRI
single voxel realignment parameters
Parameter estimation
In linear regression the parameter is estimated so that
the best prediction of Y can be obtained from X

i.e. sums of squares of difference between predicted


values and observed data, (i.e. the residuals, ) is
minimised

Remember last weeks talk & graph!

The method of estimating parameters in GLM is


essentially the same, i.e. minimising sums of squares
(ordinary least squares), it just looks more complicated
Last weeks graph

= y , predicted value
= y i , true value

y = x + c = residual error
Residual Sums of Squares
Take a set of parameter estimates,

Put these into the GLM equation to obtain estimates of Y from X, i.e.
fitted values, Y :
Y =X x

The residual errors, e, are the difference between the fitted and
actual values:
e=Y-Y = Y - X

Residual sums of squares is: S = jJej2


When written out in full this gives:

S = jJ(Yj - Xj1 1 -- XjL L ) 2


Minimising S
If you plot the sum e = Y - X
of squares value S = jJej2
for different
parameter, , S = (Y -

sums of squares (S)


estimates you get X )2
a curve

S is minimised
when the
gradient of this
Gradient = 0
curve is zero min S

parameter estimates(B)
Minimising S cont.
so to calculate the values of which gives you the
least sums of squares you must find the partial derivative
of

S = jJ(Yj - Xj1 1 -- XjL L ) 2

Which is
S/ = 2(-Xjl)(Yj Xj1 1-- XjL L)

and solve this for S/ =0


In matrix form of the residual sum of squares is
S = eTe
this is equivalent to jJej2
(remember how we multiply matrices)

e=Y-X therefore S = (Y - X )T(Y - X )


Minimising S cont.
Need to find the derivative and solve for S/ =0
The derivative of this equation can be rearranged to give

XTY = (XTX)
when the gradient of the curve = 0, i.e. S is minimised

This can be rearranged to give:

= XTY(XTX)-1
But a solution can only be found, if (XTX) is invertible
because you need to divide by it, which in matrix terms is
the same as multiplying by the inverse!
GLM and fMRI
How does the GLM apply to fMRI experiments?

Y = X . +
Observed data: Design matrix: Parameters: Error:

SPM uses a mass Several components which Define the Difference


univariate explain the observed data, i.e. contribution of each between the
approach that is the BOLD time series for the component of the observed
each voxel is voxel design matrix to the data, Y, and
treated as a Timing info: onset vectors, value of Y that predicted
separate column Omj, and duration vectors, Dmj Estimated so as to by the model,
vector of data. HRF, hm, describes shape of minimise the error, , X .
Y is the BOLD the expected BOLD response i.e. least sums of Not assumed
signal at various over time squares to be spherical
time points at a Other regressors, e.g. in fMRI
single voxel realignment parameters
fMRI models
Completed the experiment, after preprocessing, the data
are ready for STATS.

STATS: (estimate parameters, , inference)


indicating evidence against the Ho of no effect at
each voxel are computed->an image of this statistic
is produce
This statistical image is assessed (other talk will
explain that)
Example: 1 subject. 1 session
Moving finger vs rest Each epoch 6 scans
7 cycles of rest and moving Whole brain acquisition data
Time series of BOLD response in one voxel
Responses at voxel (x, y, z)

Question:
Is there any change in the
BOLD response between
moving and rest?

Time seconds
Linear Time Series Model
TIME SERIES:
consist on the sequential
measures of fMRI data signal
intensities over the period of the
experiment

The same temporal model is


used at each voxel

Mass-univariated model and


perform the same analysis at
each voxel Time

Therefore, we can describe the


complete temporal model for
fMRI data by looking at how it
works for the data from a voxel. Single Voxel Time Series
Y: My data/ observations
My Data
Time series of N observations
Y1,,Ys,,Yn.

N= scan number

Acquired at one voxel


at times ts, where S=1:N

Time
Y1
Ys
YN
Single Voxel Time Series
Model specification
The overall aim of regressor generation is to come
up with a design matrix that models the expected
fMRI response at any voxel as a linear
combinations of columns.

Design matrix formed of several components


which explain the observed data.

Two things SPM need to know to construct the


design matrix:
Specify regressors
Basis functions that explain my data
Model specification
Specify regressors X
Timing information consists of onset vectors
Omj and duration vectors Dm
Other regressors e.g. movement parameters
Include as many regressors as you consider
necessary to best explain whats going on.

Basis functions that explain my data (HRF)


Expected shape of the BOLD response due to
stimulus presentation
GLM and fMRI data
Model the observed time series at each voxel as a linear
combination of explanatory functions, plus an error term

Ys= 1 X1(tS)+ + l Xl(tS)+ + L XL(tS) + s

Here, each column of the design matrix X contains the


values of one of the continuous regressors evaluated at
each time point ts of fMRI time series

That is, the columns of the design matrix are the discrete
regressors
GLM and fMRI data
Consider the equation for all time points, to give a set of equations
Y1= 1 X1(t1)+ + l Xl(t1)+ + L XL(t1) + 1

Ys= 1 X1(tS)+ + l Xl(tS)+ + L XL(tS) + s

YN= 1 X1(tN)+ + l Xl(tN)+ + L XL(tN) + N


In matrix form:

Y1 X1(t1) Xl(t1) XL(t1) 1 N


= X1(tS) Xl(tS) XL(tS) l + s
Ys X1(tN) Xl(tN) XL(tN) L N
YN

In matrix notation: Y=X+


Getting the design matrix
Observations Regressors

= 1 + 2 +
Errors are
Time

normally and
independently
and identical
distributed

Intensity
y= x1 x2
Getting the design matrix
Observations Regressors Error

= + 2 +
1
Time

Intensity

y= 1x1 + 2x2 +
Design matrix
Observations Regressors Error

1
= x +
2

Y = X +
Design matrix
Observations Regressors Error
l L
l

l
Model is specified by:
2
Y = X + design matrix
1 Assumptions about
Y1 X1(t1) Xl L
(t1) X (t1) 1 N
Ys X1(tS) Xl(tS) XL(tS) l s
YN X1(tN) Xl(tN) XL(tN) L N
L
N N N

N: nuber of scans
P: number of regressors Y=X+
Parametric estimation

=Y-Y = Y - X
2
= +
1
+
S = tJt2
The error is minimal when

= XTY(XTX)-1
Least squares
Y X Parameter estimates

Estimate parameters (Get this by putting into matrix form


and finding derivative)
Summary
The General Linear Model allows you to find the
parameters, , which provide the best fit with your data, Y

The optimal parameters estimates, , are found by


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

The design matrix in SPM contains the information about


the factors, X, which may explain the observed data

Once we have obtained the s at each voxel we can use


these to do various statistical tests

but that is another talk.


THE END
Thank you to
Lucy, Daniel and Will
and to
Stephan for his chapter and slides about GLM
and to
Adam for last years presentation

Links:
http://www.fil.ion.ucl.ac.uk/~wpenny/notes03/slides/glm/slide1.htm
http://www.fil.ion.ucl.ac.uk/spm/HBF2/pdfs/Ch7.pdf
http://www.fil.ion.ucl.ac.uk/~wpenny/mfd/GLM.ppt

S-ar putea să vă placă și