# Idiot's guide to General Linear Model & fMRI Idiot's guide to... General Linear Model & fMRI fMRI model, Linear Time Series, Design Matrices, Parameter estimation, *&%@! Elliot Freeman, ICN. General Linear Model & fMRI How does GLM apply to fMRI experiments? Y = X . + Observed = Predictors * Parameters + Error BOLD = Design Matrix * Betas + Error Observed data Y is a matrix of BOLD signals: Each column represents a single voxel sampled at successive time points.

Preprocessing ... Y Time Y= X. + Intensity Univariate analysis Each voxel considered as independent observation Analysis of individual voxels over time, not groups over space SPM would still work on an Amoeba! Y= X. + Continuous predictors Y Scan no Voxel 1 Y= X. + X 1 57.84 Task difficulty 5

2 57.58 4 3 57.14 4 4 55.15 2 5 55.90 3 6 55.67 1 7 58.14 6 8 55.82 3

9 55.10 1 10 58.65 6 11 12 56.89 55.69 5 2 X can contain values quantifying experimental variable Y= X. + Binary predictors Y Voxel 1 60 Task difficulty 59.5 59 1 57.84 0

2 57.58 0 3 57.14 0 4 55.15 0 5 55.90 0 6 55.67 0 56.5 7 58.14 1 56 8

55.82 1 55.5 9 55.10 1 55 10 58.65 1 54.5 11 12 56.89 55.69 1 1 54 58.5 58 voxel value Scan no

X 57.5 57 0 1 Condition X can contain values distinguishing experimental conditions Parameters & error : slope of line relating X to Y how much of X is needed to approximate Y? the best estimate of minimises : deviations from line Y= X. + this line is a 'model' of the data slope = 0.23 intercept = 54.5 Y= X. + Design Matrix Scan no

Y X1 Voxel 1 Task difficulty 5 X2 X1 Constant variable 1 1 57.84 2 57.58 4 1 3 57.14 4 1 4 55.15

2 1 5 55.90 3 1 6 55.67 1 1 7 58.14 6 1 8 55.82 3 1 9 55.10 1

1 10 58.65 6 1 11 56.89 5 1 12 55.69 2 1 Matrix represents values of X Different columns = different predictors X2 Y= X. + Matrix formulation Y1 Y2 YN = X1(t1)t1)

X1(t1)t2) X1(t1)tN)) X2(t1)t1) ... X2(t1)t2) ... X2(t1)tN)) ... XL(t1)t1) XL(t1)tS) XL(t1)tN)) (t) ^ = (5 * ) + (1 * ) Y 1 1 2 ^Y = (4 * ) + (1 * ) 2 1 2 ... ^Y = (X1 * ) + (X2 * ) (t1)tN)) (t1)tN)) N 1 2 time (t) 1 2 L Y Voxel 1 57.84 X1

Task difficulty 5 + X2 Constant variable 1 1 2 57.58 4 1 3 57.14 4 1 4 55.15 2 1 5 55.90 3

1 6 55.67 1 1 7 58.14 6 1 8 55.82 3 1 9 55.10 1 1 10 58.65 6 1

11 56.89 5 1 12 55.69 2 1 (t1)t1) (t1)t2) (t1)tN)) X1 X2 Parameter estimation and stats Find betas (by least squares estimation) Y= X -> B = Y / X X -> B = Y / X X X -> B = Y / X -> X -> B = Y / X B X -> B = Y / X = X -> B = Y / X Y X -> B = Y / X / X -> B = Y / X X X -> B = Y / X (B= estimated ) Matlab magic: >> B = inv(X) * Y Now find error term: e = Y (X * B ) ...and use these results for statistics: t = betas / standard error Covariates vs. conditions Covariates: X -> B = Y / X parametric modulation of independent variable e.g. task-difficulty 1 to 6

-> regression: beta = slope Conditions: 'dummy' codes identify different levels of experimental factor specify time of onset and duration e.g. integers 0 or 1: 'off' or 'on' -> ANOVA: beta = effect mean on off off on Modelling haemodynamics Brain does not just switch on and off! -> Reshape (convolve) regressors to resemble HRF Original HRF Convolved HRF basic function Anatomy of a design matrix Example: 5 subjects 2 conditions per

subject 6 replications per condition 1 covariate conditions subjects covariates Interesting vs. uninteresting Important to model all known variables, even if not experimentally interesting: e.g. head movement, block and subject effects minimise residual error variance for better stats effects-of-interest means adjusted to eliminate effectsof-no-interest global conditions: activity or movement effects of subjects interest Selecting and comparing betas A beta value is estimated for each column in design matrix A contrast variable is used to select (groups of) conditions and compare with others e.g. mean (2 4 6 ...) - mean (1 3 5 ...)

t statistic = ( 1 2 3 ... ) . -1 / SE 1 -1 ... t-test: t > critical value ? Summary: Reverse Cookery You start with the finished product and want to know how it was made You specify which ingredients to add (design matrix variables) For each ingredient, GLM finds the quantities (betas) that produce the best reproduction (model) Now you can compare your recipe with others (null hypothesis) to see if they differ! (statistical tests) How dumb was that? Sources: http://www.fil.ion.ucl.ac.uk/spm/doc/papers/SPM_3/welcome.html http://www.fil.ion.ucl.ac.uk/spm/doc/books/hbf2/pdfs/Ch7.pdf http://www.mrc-cbu.cam.ac.uk/Imaging/Common/spmstats.shtml