GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

116
GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1

Transcript of GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Page 1: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

1

GLM for fMRI

Emily Falk, Ph.D.

University of Pennsylvania

Thanks to Thad Polk and Elliot Berkman

Page 2: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Review of preprocessing

2

Page 3: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Y X

2nd level (Group)

GLM

Acquire Structurals

(T1)

Acquire Functional

s

Determine Scanning Parameters

Template

Slice Timing CorrectPredictors(De-noise)

RealignSmooth

Co-Register

All subjects

Normalize

β

y = Xβ + ε1st level (Subject) GLM

Contrast

Threshold

βhow - βwhy

3

Page 4: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Determine Scanning Parameters

4

Page 5: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Determine Scanning parameters

Signal-Noise Ratio (SNR)

Temporal Resolution

Coverage/ Field of

View

Spatial Resolution

-

- - -

-

5

Page 6: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Acquire Structurals

(T1)

Acquire Functionals

Determine Scanning Parameters

Slice Timing Correct

6

(De-noise)

Page 7: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Time

Slice

TR #1 TR #2 TR #3 TR #4

Slice 1

Slice 2

Slice 3

Slice 4

7

Page 8: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Acquire Structurals

(T1)

Acquire Functional

s

Determine Scanning Parameters

Slice Timing Correct

(De-noise)Realign

8

Page 9: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Realignment

Minimize sum of squared diff

reslice

9

Page 10: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Acquire Structurals

(T1)

Acquire Functional

s

Determine Scanning Parameters

Template

Slice Timing Correct

(De-noise)Realign

Co-Register

Normalize

10

Page 11: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Co-registration

Can’t use minimized squared difference on different image types (different tissue -> signal intensity mapping)

Instead use mutual information (maximize)

reference moved image

11

Page 12: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

normalization

12 parameter affine transformation

Trans x Pitch x Roll x Yaw x Zoom x Sheer

SheerZoom

Even better with segmentation!12

Page 13: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Smoothing

Page 14: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Y X

Acquire Structurals

(T1)

Acquire Functional

s

Determine Scanning Parameters

Template

Slice Timing CorrectPredictors(De-noise)

RealignSmooth

Co-Register

Normalize

14

Page 15: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

How

Why

X =

Forming predictors

Events Basis Function Predictors (X)

15

Page 16: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Y X

2nd level (Group)

GLM

Acquire Structurals

(T1)

Acquire Functional

s

Determine Scanning Parameters

Template

Slice Timing CorrectPredictors(De-noise)

RealignSmooth

Co-Register

All subjects

Normalize

β

y = Xβ + ε1st level (Subject) GLM

Contrast

Threshold

βhow - βwhy

16

Page 17: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

17

Y X

2nd level (Group)

GLM

Acquire Structurals

(T1)

Acquire Functional

s

Determine Scanning Parameters

Template

Slice Timing CorrectPredictors(De-noise)

RealignSmooth

Co-Register

All subjects

Normalize

β

y = Xβ + ε1st level (Subject) GLM

Contrast

Threshold

βhow - βwhy

Page 18: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

18

Lecture Outline

1. Hypothesis Testing (covered Sunday)Null hypothesis vs. alternative hypothesis; Testing hypotheses about population based on a sample; Sampling distributions & Central Limit Theorem; t-statistic, t-distribution, t-tests, p-values; Interpreting results, Type I error, Type II error; One-tailed vs. two-tailed tests; Multiple comparisons

2. General Linear ModelRegression, multiple regression, model fitting, matrix notation, design matrix, example, issues

3. Overview of fMRI data analysisBuild design matrix, fit model to get betas, contrasts, statistical parametric maps, threshold for significance (correcting for multiple comparisons)

Page 19: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

19

In fMRI, we experimentally manipulate various independent variables (e.g., task, stimulus) while scanning

We are interested in constructing a model of the predicted brain activity that can be used to explain the observed fMRI data in terms of the independent variables.

In fitting the model to the data, we obtain parameter estimates and make inferences about their consistency with the null hypothesis.

Statistical Model

Page 20: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

20

The General linear model (GLM) approach treats the data as a linear combination of predictor variables plus noise (error).

The predictors are assumed to have known shapes, but their amplitudes are unknown and need to be estimated.

The GLM framework encompasses many of the commonly used techniques in fMRI data analysis (and data analysis more generally).

General Linear Model

Page 21: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

21

The GLM Family

One continuous

Predictors

Repeated measures

ContinuousOne predictor

Categorical1 pred., 2 levels

More than two measures

Multiple Regression

2-sample t-test

One-way ANOVA

Analysis

Repeated measures ANOVA

DV

General Linear Model

Paired t-test

ContinuousTwo+ preds

Regression

Categorical1 p., 3+ levels

Categorical2+ predictors

Factorial ANOVA

Two measures, one factor

Page 22: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

22

A simple linear model with one predictor (a made up, non-fMRI example)

• Fit a straight line to the data, the “best fit”• This line is a simplification, a model with two parameters:

intercept and slope• Can use the model to make predictions• Can test the slope parameter against a null hypothesis of

zero, and make inferences about whether there is a statistically significant relationship

Attractiveness

Blu

shin

g

(b

lood

flow

to

cheeks)

Page 23: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

23

• Vector notation: y, x, and e are vectors of N values corresponding to N observations

The Regression Model

Outcome

(DV)

Intercept

(constant)slope

Predictor value

Error (residual)

For point i:

Page 24: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

24

• The line is being pulled by vertical rubber bands attached to each point. Vector of red lines is e

• Minimize squares of vertical distance to lines. Minimize:

Fitting and Residual Variance

Attractiveness

Blu

shin

g

(b

lood

flow

to

cheeks)

Page 25: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

25

• Structural Model for Regression

The Multiple Regression ModelBasic Model for the GLM

DV

intercept

Slope 1

Slope 2

Slope k

Error

Pred1 Pred2 Predk

Matrix notation • solve for beta vector

• minimize sum of squared residuals

Variables

Parameters

Page 26: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

26

• Alternatively, we can write

Matrix Notation

as

Observed Data Design matrix

Model parameters

Residuals

Page 27: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

27

Matrix Notation

Is this same as

Observed Data Design matrix

Model parameters

Residuals

Page 28: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

28

In fMRI the design matrix specifies how the factors of the model change over time.

The design matrix is an np matrix where n is the number of observations over time and p is the number of model parameters

Design Matrix

Page 29: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

29

• Does exercise predict life-span?• Control for other variables that might be

important. i.e., gender (M/F)

Another Made-up, Non-fMRI Example

Females

Males

Page 30: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

30

A Non-fMRI Example

Outcome Data Design matrix Model parameters Residuals

= X +

Page 31: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

31

• Coefficients (betas) for individual predictors test for variance uniquely explained by that predictor

• When predictors are intercorrelated, interpreting the betas can become very tricky! • Changes in sign of one beta when you add others• Changes in significance of one beta when you add others

• This is because the predictors are attempting to explain the SAME variance

• This is called multicollinearity.

Multicollinearity

Page 32: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

32

Implications for fMRI

• You have at least some control over the design matrix, X, because you manipulate the stimulation.

• Avoid multicollinearity and complex issues with good experimental design!

• Do not use a design with many or highly correlated predictors and expect the modeling to sort everything out

Page 33: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

33

Lecture Outline

1. Hypothesis Testing (covered last night)Null hypothesis vs. alternative hypothesis; Testing hypotheses about population based on a sample; Sampling distributions & Central Limit Theorem; t-statistic, t-distribution, t-tests, p-values; Interpreting results, Type I error, Type II error; One-tailed vs. two-tailed tests; Multiple comparisons

2. General Linear ModelRegression, multiple regression, model fitting, matrix notation, design matrix, example, issues

QUESTIONS?

Page 34: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

34

Lecture Outline

1. Hypothesis Testing (covered last night)Null hypothesis vs. alternative hypothesis; Testing hypotheses about population based on a sample; Sampling distributions & Central Limit Theorem; t-statistic, t-distribution, t-tests, p-values; Interpreting results, Type I error, Type II error; One-tailed vs. two-tailed tests; Multiple comparisons

2. General Linear ModelRegression, multiple regression, model fitting, matrix notation, design matrix, example, issues

3. Overview of fMRI data analysisModel specification, parameter estimation, contrasts, statistical parametric maps, threshold for significance (correcting for multiple comparisons)

Page 35: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

35

A simple research question?• What are the neural correlates of positive

valuation (see recent meta analysis by Bartra et al.)

Page 36: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

36

fMRI: Example

Page 37: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

37

Time

Off

On

Off

On

X1

X2

Page 38: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

38

β1 β2

β1

β1

β1 β1

β1β1β1

β1

β1 β1

β1 β1β1

β1

β1 β1

β1 β1

β1β1β1

β1

β2β2

β2

β2

β2β2

β2

β2β2

β2β2

β2β2β2 β2β2

β2β2 β2

β2

β2

β2

Page 39: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

39

-

Page 40: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

40

The SPM way of Plotting the Variables

= +

y X e

Page 41: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

41

T-test – contrasts – SPM{t}

cT = 1 -1 0 0 0 0 0 0

T =

contrast ofestimated

parameters

varianceestimate

Difference between seeing loved one and random face > 0 ?

=b1 – b2 = cTb> 0 ?

b1 b2 b3 b4 b5 ...

Question:

Null hypothesis: H0: cTb=0

Test statistic:

Page 42: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

42

T-test: Another Simple Example

Q: activation during attribution?

cT = [ 1 0 ]

Null hypothesis: 1=0

Why versus rest

Design matrix

0.5 1 1.5 2 2.5

10

20

30

40

50

60

70

80

1

Page 43: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

43

More specifically…

Page 44: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

44

• Tasks are typically designed to isolate mental processes of interest by comparing parameter estimates (betas)– Viewing hot vs. neutral faces– Why vs. how

• The comparison involves a linear combination of the parameter estimates– Note: investigating a single parameter estimate is

also a contrast and sometimes termed a contrast against the implicit baseline

Isolating Mental Processes

Page 45: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

45

Voxel-wise Time Series Analysis

Time

BOLD signal

Tim

e

single voxeltime series

Modelspecification

Parameterestimation

Hypothesis

Statistic

SPM

Page 46: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

46

fMRI Example: One Voxel

Temporal series fMRI voxel time course

amplitude

time

Sou

rce:

J-B

. P

olin

e

Page 47: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

47

Model Specification:Building The Design Matrix

fMRI Data Design matrix

Model parameters

Residuals

= X +

Predicted task response

intercept

Page 48: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

48

Parameter Estimation/Model Fitting

y

ERROR

=

+

+

0

1

Find values that producebest fit to observed data

Page 49: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

49

The SPM Way of Plotting the Variables

= +

y X e

Page 50: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

50

• beta_####.img– Parameter estimates (β)

• T-contrast– spm_con_####.img

• Contrast image• If you take the

appropriate beta_####.img’s and linearly combine them, it will be identical to the spm_con_####.img

– spm_T_####.img• T-statistic image

• F-contrast– spm_ess_####.img

• Extra sum-of-squares image

– spm_F_####.img• F-statistic image

• ResMS.img– Residual sum-of-squares

(σ 2)

What SPM Computes

Page 51: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

51

Statistical Parametric Maps

con_???? image

beta_???? images

spmT_???? image

SPM{t}

Page 52: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

52

T-test – One Dimensional Contrasts – SPM{t}

cT = 1 0 0 0 0 0 0 0

T =

contrast ofestimated

parameters

varianceestimate

box-car amplitude > 0 ?=

b1 = cTb> 0 ?

b1 b2 b3 b4 b5 ...

Question:

Null hypothesis: H0: cTb=0

Test statistic:

Page 53: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

53

Model Specification:Building The Design Matrix, Adding Predictors

fMRI Data Design matrix Model parameters

Residuals

= X +

Predicted task response

intercept

Page 54: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

54

The SPM Way of Plotting the Variables

= +

y X e

Page 55: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

55

T-test – One Dimensional Contrasts – SPM{t}

cT = 1 -1 0 0 0 0 0 0

T =

contrast ofestimated

parameters

varianceestimate

box-car amplitude > 0 ?=

b1 = cTb> 0 ?

b1 b2 b3 b4 b5 ...

Question:

Null hypothesis: H0: cTb=0

Test statistic:

Page 56: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

56

T-test: A Simple Example

Q: Greater activation during why than

how?cT = [ 1

-1 ]

Null hypothesis: 1-2=0

Why vs. How

Design matrix

0.5 1 1.5 2 2.5

10

20

30

40

50

60

70

80

1

Page 57: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

57

T-test: A slightly more complicated example

What happens in the brain during attribution?

A

B

C

D

Page 58: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

58

Another slightly more complicated design

• Do peer ratings change underlying assessments of the attractiveness of faces or merely public reporting (see work by Klucharev et al. and Zaki et al.)

• Manipulate peer ratings (higher, lower, same, no rating)

Page 59: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

59

• We can estimate the full design matrix, and then apply contrasts to betas after model fitting to estimate effects of interest and make inferences.

t-contrasts

Time

Design Matrix (X) A B C D Covariates

fit apply C

Courtesy of Tor Wager

Page 60: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

60

t-contrasts

C’b is effect magnitude estimate for (A + B) – (C + D), equivalent to mean(A,B) - mean(C,D) or WHY> HOW

C’b is beta for A only, or WHY_faces > rest

C’b is sum (average) beta for A and B, or WHY > rest

• Statistical contrasts typically sum to zero so that E(C’b) = 0. Makes testing easy.

• Scaling doesn’t matter for most inference, but good to get into habit of using fractions if you need to average.

– [1 -1] and [.5 -.5] give same statistical result (though can affect other calculations like percent signal change).

Time

Design Matrix (X) A B C D

-1

-1

Page 61: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

61

Page 62: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

62

• T-contrast– Test of a specific combination of predictors

• Linear combination differs from zero (e.g., why – how)?

– Signed: effect can be positive or negative• Some areas might be higher for why and some higher for how

• F-contrast– Test on a set of predictors

• Variance explained by a set of predictors greater than zero?

– Unsigned: amount of variance explained can only be positive– Any t-contrast can be specified as a F-contrast (without the

sign)

Two Kinds of Contrasts

Page 63: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

63

• Test of set of linear contrasts

– 1) Does a set of regressors explain a significant amount of variance?

• E.g., model with and without temporal derivatives

– 2) Set of differences• E.g., an overall effect of time (T1-T2; T2-T3)

F-Contrast

Page 64: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

64

• Contrasts can be a linear combination of parameter estimates (t-contrast) or a set of linear combinations of parameter estimates (F-contrast)

• Inference on these contrasts can be performed at the single subject level where degrees of freedom are dictated by number of scans and number parameters modeled

Summary

Page 65: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

65

Questions?

Page 66: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

66

Note: Multiple Runs

• Each run is estimated by a separate GLM– Run: one set of scans (typically 5-10

min)– SPM calls this a “Session” although in

typical parlance, a “Session” refers everything that occurs in-between putting a subject in the scanner and taking them out

• Due to– Mean signal varies on a run-by-run

basis• Different intercept term for each run• SPM scales images on a per run basis so

that mean signal across a run is 100

– Low frequency drift and temporal autocorrelation are defined within a run

Put participant in scanner Localizer Functional Run 1 Block 1 Trial 1 Trial 2 … Trial n Block 2 … Block n Functional Run 2 … Functional Run n StructuralTake participant out of scanner

BlockRunSession

Page 67: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

67

Design Matrix in SPM: One Run

Page 68: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

68

Design Matrix in SPM: Multiple Runs

Run 1Predictors of interest

Intercept

Page 69: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

69

Design Matrix in SPM: Multiple Runs

Run 2Predictors of interestIntercept

Page 70: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

70

Note re: contrasts and multiple runs

• If your runs all have the same conditions in the same order (aim for this):– You can specify the contrast weights for one run

and SPM will assume same for other runs• If your runs don’t conform this way:

– You can specify custom contrast across all run/conditions

Page 71: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

71

Example

Input: 0 0 1Input: 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1

Page 72: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

72

Questions?

Page 73: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

73

Parametric modulation

Page 74: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

74

What if you want to model a continuous variable?

e.g., making mental state attributions for people rated more or less similar to the participant

Page 75: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

75

• Modeling changes in brain activity as a function of performance or other continuous variables across multiple levels can provide strong inference– Load, confidence, RT, etc.

Parametric Modulation

Goal (purchase) value of an item

Courtesy of Tor Wager

Page 76: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

76

Examples

• Effect of attribution (Why > How) modulated by:– Identification with person in the photo– Attractiveness of person in the photo– Accuracy of attribution (i.e., consensus with other

raters)

• Parametric effect on face viewing of:– Ppt. attractiveness rating of face– Peer rating of face– Peer rating of face, controlling for initial rating of face

Page 77: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

77

Parametric Psychological Events

Principle Predictor: Captures Average Response

Idealized Data

Fitted Response

Parametric Modulator: Captures Modulations

Courtesy of Tor Wager

Page 78: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

78

• Modulators are orthogonalized w.r.t. principle regressor and each other– Order matters– Modulators will capture residual activation not

captured by preceding regressors

• Example:– Why, Why*Similarity, Why*Attractiveness– Why, Why*Attractiveness, Why*Similarity

Parametric Modulation: Details

Page 79: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

79

• Modulators model differences in amplitude of response only– Not duration

• Suggested to vary duration of event rather than use parametric modulation in these cases (“variable epoch” model)

Parametric Modulation: Details

Average response

Parametric modulator

(parametric modulator framework)

Page 80: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

80

Visual cortex: Contrast-modulation (red) vs. duration-modulation (blue)

Grinband et al., 2008

Page 81: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

81

Parametric Modulation: Contrasts with PMs

= +

y X e

Contrast: 1 0 = main effect of condition AContrast: 0 1 = effect of pm

AA*pm

Page 82: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

82

• Include modulator(s) can be a good idea to capture parametric effects

• Understand that modulator(s) are orthogonalized to principle regressor and each other when making inferences– Can be adjusted in SPM code by removing calls to

“spm_orth”

• Amplitude modulators may not capture appropriate variance if modulation affects both amplitude and duration of response– Including “variable epochs” and orthogonalizing them w.r.t.

principle regressor may be more appropriate

Parametric Modulation: Summary

Page 83: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Covariates/ Nuisances

83

Page 84: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

• fMRI data contains large contributions from factors of non-interest (nuisances)• E.g. Scanner instability

• A few such nuisances are:• Low frequency drift• Temporal autocorrelation• Motion

Nuisances in fMRI

84

Page 85: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Low Frequency Drift

fMRI Noise: Time domain Frequency domain

Unf

ilter

ed

Lot’s of low frequency power!85

Page 86: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Effect of Low Frequency Drift

blue = datablack = mean + low-frequency driftgreen = predicted response, taking into account

low-frequency driftred = predicted response, not taking into account low-frequency drift

86

Page 87: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Accounting for Low Frequency Drift

High-pass filter: High frequency elements are allowed to pass

Default in SPM is 128

In SPM, filter is applied to both data and design

87

Page 88: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

High-Pass Filtering

fMRI Noise: Time domain Frequency domain

60 s HP filter

1/60 = .016 Hz

Unf

ilter

edF

ilter

ed

Courtesy of Tor Wager88

Page 89: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Low Frequency Drift Considerations

• Avoid long epochs or conditions that repeat at a very low frequency

• Check if filter removes power from predictors of interest and adjust if necessary

• Rule of thumb: 2 x the longest periodicity in the design

Predictor

Power

Filtered frequencies

89

Page 90: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

• fMRI data contains large contributions from factors of non-interest (nuisances)• E.g. Scanner instability

• A few such nuisances are:• Low frequency drift• Temporal autocorrelation• Motion

Nuisances in fMRI

90

Page 91: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Temporal Autocorrelation

• Nearby time-points exhibit positive correlation• Physiological and

scanner instability

Lag 0

r = 1

91

Page 92: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Temporal Autocorrelation

• Nearby time-points exhibit positive correlation• Physiological and

scanner instability

Lag 1

r = 0.6

92

Page 93: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Temporal Autocorrelation

• Nearby time-points exhibit positive correlation• Physiological and

scanner instability

Lag 2

r = 0.3

93

Page 94: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Temporal Autocorrelation

• Nearby time-points exhibit positive correlation• Physiological and

scanner instability

Lag 3

r = 0.1

94

Page 95: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

• Nearby time-points exhibit positive correlation• Physiological and scanner instability

• GLM assumes that errors are independent• Correlated errors violate this assumption (changes

degrees of freedom)

Temporal Autocorrelation

Autocorrelation function

Random errorsAutocorrelated

Errors 95

Page 96: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

• Model correlation structure, V– Model data ignoring temporal autocorrelation– Use residuals to estimate temporal autocorrelation

• Assume autoregressive (AR) model– Signal at time t depends on signal at previous time points plus noise

• Use estimated autocorrelation to filter the data and design matrix

Temporal Autocorrelation: Solution

96

Page 97: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Autocorrelation: Case Study

“Model serial correlations: none”

“Model serial correlations: AR(1)”

Courtesy of Tor Wager97

Page 98: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

• Understand that autocorrelation exists and that there are algorithms to correct it– Specific algorithm will vary from package to package

• Understand that it impacts inference on individuals (1st level) if not accounted for– Residual variance will be biased

• Parameter estimates will be unbiased if autocorrelation is not taken into account

• Parameter estimates will be less precise if autocorrelation is not taken into account

Temporal Autocorrelation: Take Home

98

Page 99: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

• fMRI data contains large contributions from factors of non-interest (nuisances)• E.g. Scanner instability

• A few such nuisances are:• Low frequency drift• Temporal autocorrelation• Motion

Nuisances in fMRI

99

Page 100: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

• Realignment spatially corrects images for motion• However, motion has profound affects on signal that

realignment does not correct

Motion Confounds

Motion

Signal Spikes

Power et al., 2012, NeuroImage100

Page 101: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

• Realignment procedures output motion parameters– 6 per scan (x, y, z,

pitch, roll, yaw)– Including these

parameters as nuisance regressors can capture motion-related signal changes and improve model fits

Motion Regression

101

Page 102: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Motion Regression Improvements

• Motion parameters capture absolute displacement over time– i.e. motion drift

• Motion-related signal artifacts are typically reflected in scan-to-scan changes– i.e. displacement relative to last scan

• Good idea to include differential motion to capture scan-to-scan changes– But remove sign

• Recommended approach is to include 24 total motion regressors (Lund et al.,

2005, NeuroImage):– Displacement, Differential, Squared Displacement, Squared Differential

102

Page 103: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

• Motion can sometimes be synched to task– Button press– Shifting during ITI– Motion regressors can be confounded with

task-related regressors in these cases

• May be a good idea to set a motion tolerance criterion and exclude motion regressors from low motion subjects

Motion Regression: Caveats

103

Page 104: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

• GLM is fit to each voxel, estimating linear contribution of each predictor

• Parameter estimates (β’s) estimate the amplitude of each predictor

• Estimates are affected by presence and absence of other predictors, so it is important to model the data as accurately as possible

• Nuisance confounds are addressed in both the data and design– High-pass filter: removed low frequency drift– Pre-whiten: remove temporal autocorrelation

• Nuisance confounds and methods to address them limit the kinds of predictors that can be effectively included in the GLM

• Multiple runs (called “Session” in SPM) are each estimated by a separate GLM

Summary

104

Page 105: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Additional notes

105

Page 106: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

• Power of predictors depends on the appropriateness of the basis function

• Thus far, assumed a “canonical” hemodynamic response function (HRF)– Double-gamma function– Peak 5s– Undershoot 15s (1/6 height of peak)– ~20s to return to baseline

• True HRF varies between individuals AND regions

Hemodynamic Response

106

Page 107: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

HRFs Vary Across Brain Regions and TasksProblem for Canonical Model!

Co

urt

esy

of T

or

Wa

ge

r

Aversive picture, n = 30 Aversive anticipation

Stimulus On• HRF shape depends on:

• Vasculature

• Time course of neural activity

See Aguirre et al. 1998, NeuroImage

Checkerboard, n = 10 Thermal pain, n = 23

107

Page 108: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

• Typically, we are interested in the amplitude of the HRF

• If true HRF peaks earlier or later than expected, amplitude estimates will be systematically biased– True HRFs often peak earlier than canonical HRF (c.f.

Handwerker et al., 2004, NeuroImage; Steffener et al., 2010, NeuroImage)

• May be especially problematic for closely spaced events– Unaccounted for variance can be shifted to earlier or later

events

HRF and Bias

108

Page 109: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

• One popular approach is to use derivatives of the canonical HRF to capture timing and dispersion related variance

Basis Sets: HRF + Derivatives

1st derivative of the HRF is the “temporal” derivative: captures peaks that occur earlier or later than expected

2nd derivative of the HRF is the “dispersion” derivative: captures narrower or wider responses than expected

Canonical only

Canonical + derivs

109

Page 110: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Basis Sets: HRF + Derivatives

Adding derivative can account for delay

Note, including derivative, but basing tests only on the non-deriv does not help!

Calhoun et al., 2004, NeuroImageCalhoun et al., 2004, NeuroImage

110

Page 111: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Basis Sets: Finite Impulse Response

• Another approach is to make no assumptions about the shape of the HRF

• Instead, a set of shifted delta functions is used to capture any response: Finite Impulse Response (FIR) set

111

Page 112: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

• Fit is sometimes better with multiple basis sets, inference is harder

• Most common approach is to use the SPM canonical HRF

112

Page 113: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

• Providing a better model fit– Basis functions

• Modeling continuous variation– Parametric modulators

• Improved confound reduction– Motion regression

Outline

113

Page 114: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

• Model fits can be made more accurate with the use of basis sets– Can help if canonical HRF is not appropriate– BUT, cost in more complicated inference or methods to extract

amplitude estimates from set of fitted parameters

• Parametric modulators can capture changes across several levels– Can lead to stronger inferences– BUT, note that duration modulation may require a variable epoch

approach

• Motion regression can substantially reduce variability– Can remove severe signal spikes– BUT, may be a good idea to set a motion tolerance criterion

Take-Home

114

Page 115: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

• The SPM listserv is a great, active resource for questions about SPM and SPM-related analyses

• Subscribe– Search “spm listserv”, click on first link (SPM LIST

at JISCMAIL.AC.UK), then click on subscribe

• If you have a question– First search the archives to see if it’s already been

asked and answered– If it hasn’t, email your question to

[email protected]

SPM Listserv

115

Page 116: GLM for fMRI Emily Falk, Ph.D. University of Pennsylvania Thanks to Thad Polk and Elliot Berkman 1.

Lecture Outline

1. Hypothesis Testing (covered last night)Null hypothesis vs. alternative hypothesis; Testing hypotheses about population based on a sample; Sampling distributions & Central Limit Theorem; t-statistic, t-distribution, t-tests, p-values; Interpreting results, Type I error, Type II error; One-tailed vs. two-tailed tests; Multiple comparisons

2. General Linear ModelRegression, multiple regression, model fitting, matrix notation, design matrix, example, issues

3. Overview of fMRI data analysisModel specification, parameter estimation, contrasts, statistical parametric maps, threshold for significance (correcting for multiple comparisons)

QUESTIONS?