fmri analysis fundamentals with a focus on task-based analysis and spm12

47
fMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Upload: caroline-stafford

Post on 27-Dec-2015

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

fMRI Analysis Fundamentals

With a focus on task-based analysis and SPM12

Page 2: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

fMRI Modeling

• Modeling goal: explain as much variability as possible

• Anything that isn’t accounted for will go into “residual error”, e — want to minimize e

• Smaller residuals -> greater significance

Page 3: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Analysis Options/History

• Subtraction: calculate difference of “on” image minus “off”, for example [Ogawa et al. 1992]

• Correlation: test for similarity of time series to stimulus series

• General Linear Model (GLM): a generalization of the above approaches– Regression type framework– Matrix-based formulation of linear models– Review paper: Poline & Brett 2012, “The general linear

model and fMRI: does love last forever?”** http://www.ncbi.nlm.nih.gov/pubmed/22343127

Page 4: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

GLM

• GLM encompasses ANOVA, ANCOVA, t-test• GLM in equation form:

Y = XB + ε (after demeaning Y and usually X)Y: voxel data (column/s). X: model (“design matrix”)B: coefficients (slopes) of fit lines (“betas”)ε: residual error

Page 5: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

GLM

• SPM’s approach is “mass univariate”: one separate equation to solve for each voxel

• Essentially, we are fitting a multiple regression model at each voxel:

• We know y and all xs, want to determine βs (and error):

Example with single x:

y = β1x1 + β2x2 + … + c

y = βx + c + ε

Page 6: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

this line is a 'model' of the data

slope β = 0.23

Intercept c = 54.5

• β: slope of line relating x to y– ‘how much of x is

needed to approximate y?’

• ε = residual error– the best estimate of β

minimises ε: deviations from line

– Assumed to be independently, identically and normally distributed (IID)

y = βx + c + ε

Source: “Idiot's guide to General Linear Model & fMRI”

Regression Example

Page 7: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Source: “Functional MRI data analysis” (C. Pernet)

Our constant term

Page 8: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Source: “Idiot's guide to General Linear Model & fMRI”

x (task)

constant term

covariates (6)

(note: now .nii)

Page 9: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Y

data ve

ctor

(v

oxel ti

me serie

s)

=

= X

design m

atrix

b1

b2

parameters

+

+

error v

ector

GLM Matrix View

Source: Rik Henson, “General Linear Model”

Page 10: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

SPM12

• As with preprocessing, uses Batch Editor• Can set up with our previously preprocessed

motor data (mot_sp task)• Or, can use this copy:

/net/ms3T/sample/mot_sp/swr*

Page 11: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

SPM Settings

• Directory: specify a new directory for results of each model

• Units for design: seconds is much easier!• Interscan interval (TR): 2• Data & Design: select sw* files (139)• We will manually enter three conditions…

Left, Right, and Rest

Page 12: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

mot_sp Conditions

• Left– Onsets: 18 60 116 158 186 242– Duration: 10

• Right– Onsets: 32 74 102 144 200 228– Duration: 10

• Rest– Onsets: 46 88 130 172 214 256– Duration: 10

Page 13: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Data Adjustment: Global Effects

• fMRI BOLD signal values are dimensionless, and vary across subjects/regions

• Hypothetical case:– region 1 has baseline 2000, changed signal of 2050

(+50)– region 2 has baseline 800, changed signal of 840

(+40)• Is it better to compare signal change? (50 >

40) Or is proportional value better? (2.5% < 5%)

Page 14: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Global Effects

• In PET, absolute change is meaningful — and early fMRI work used PET methods

• In fMRI, proportion of change believed to be more relevant

• Note: other possibilities could be considered, e.g. z-transformation

Page 15: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Global Effects

• SPM terms:– Global scaling: adjust each volume (TR) to have

same mean (PET holdover, not recommended)– Grand mean scaling: scale so “grand mean” has a

particular value (100); automatic in SPM– “grand mean” (g): across all voxels and timepoints

Grand mean scaling amounts to multiplying all voxels in a session by 100/g

Page 16: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Why Not Global Scaling?

• Problem: true global is unknown, and volume mean may be unreliable proxy– Large signal changes over some area can confound

global with local changes– Possible consequence: artifactual deactivations

after global scaling• Other ways to account for volume-to-volume

drift (high-pass filtering)

Page 17: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

fMRI Noise

• Scanner signal commonly “drifts” slowly over time

• Physiological fluctuations (heartbeat, breathing) add other noise

• Goal: find and remove any structured noise– Convenient to use frequency domain, especially

for periodic changes– “Linear” drift approximated by “1/f” noise (long

period)

Page 18: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Frequency Domain

Source: Handbook of Functional MRI Data Analysis

Source: Human Brain Function ch. “Issues in Functional Magnetic Resonance Imaging”

Page 19: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Removing Noise

• Nyquist Theorem: if sample rate is insufficient, samples can appear to have a lower frequency

Example: are blue dots from blue or red curve?

Without a higher sample rate, red is undersampled: we attribute to blue what might be from red

aliasing

Page 20: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Noise Sources

• What about physiological noise sources?– 1 Hertz = 1 cycle per second– fMRI sampling rate ≈ 0.5 Hz (~0.3-0.6 = TR 3.33-

1.67) – Nyquist limit: frequencies > ½ sample rate are

aliased (appear partially at other frequencies)

• Heart rate ≈ 1 Hz: no way • Breathing rate ≈ 0.1-0.3 Hz: no?

Page 21: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Filtering Noise

• Just zap all frequencies below Nyquist limit?– No: the task is a legitimate source of periodic

variation, too…– 30s alternating blocks = 1/60 Hz frequency

• “High-pass filter”: pass (leave intact) signal at frequency greater than some x (and remove slower variations)

• x = 1/128 Hz in SPM (based on typical data)• You can test your own data!

Page 22: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Power Spectral Density

• Using ART tool

• Note: only task, not signal, here

HPF (@ 1/128)

Page 23: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Implementation of HPF

• High-pass filtering options:– Directly filter the data (fit a model, subtract low

frequency trends): FSL– Use covariates for various frequencies: SPM

Source: Mumford, “First-level Statistics”, UCLA NITP 2008

Page 24: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Collinearity

• In regression, correlated regressors can’t be uniquely solved for, so interpretability suffers– Individually, regressors may have no significant

impact– Overall, a model may nonetheless have low error

• Not a big deal if “nuisance covariates” (such as for HPF) are correlated

• A problem if you want to assess individual covariates

Page 25: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Example: Task-correlated Motion

• Incidental: e.g., subject nods when responding “yes”

• Design related: e.g., if task is “press a button to get a reward when you spot a target”– When looking for “reward processing” areas, you

will get motor areas as well– Need a more careful design to distinguish motor

and reward activations here

Page 26: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Noise & Modeling

• “white noise”– AKA, in SPM-speak, “sphericity”– all frequencies equally represented– No problem for least-squared estimation

• “colored noise”– AKA “non-sphericity”– has structure; problems for least-squares estimation– highpass filtering helps (for low frequency noise)– “whitening”: alter the covariance matrix toward white

noise

Page 27: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Autocorrelation and Whitening

• Autocorrelation: in general, cross-correlation of a signal with itself (under various lags)

• In fMRI, successive timepoints are correlated• Can whiten using an autoregressive (AR) model

– AR(1): previous timepoint (+ noise) contributes to value of current timepoint

– AR(2): previous 2 timepoints (etc.)• SPM99: AR(1) with a fixed weight (correlation) of 0.2• Later SPMs: AR(1), correlation estimated in first pass

– SPM lingo: "hyperparameter estimation”– This is why appearance of design matrix in SPM changes after model

estimation

Page 28: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Modeling HRF (Redux)

Lindquist et al. 2009

• Recall: signal comes from the BOLD effect, and is assumed to track neural activity

• Knowing/assuming an HRF shape, we can predict BOLD response to stimuli

Page 29: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

HRF Options

• In SPM, multiple basis functions:– canonical HRF– canonical HRF with derivatives– Finite Impulse Response (FIR)– Fourier– Gamma

• The default choice is canonical HRF, and we’ll focus on that

Page 30: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

SPM Canonical HRF

• Difference of Gammas

Gamma Distribution (Wikipedia)

Page 31: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

% returns a hemodynamic response function % FORMAT [hrf,p] = spm_hrf(RT,[p]); % RT - scan repeat time % p - parameters of the response function (two gamma functions) % % defaults % (seconds) % p(1) - delay of response (relative to onset) 6 % p(2) - delay of undershoot (relative to onset) 16 % p(3) - dispersion of response 1 % p(4) - dispersion of undershoot 1 % p(5) - ratio of response to undershoot 6 % p(6) - onset (seconds) 0 % p(7) - length of kernel (seconds) 32 % % hrf - hemodynamic response function

SPM’s HRF Code (spm_hrf.m)

Page 32: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

% Copyright (C) 1996-2014 Wellcome Trust Centre for Neuroimaging

% Karl Friston% $Id: spm_hrf.m 6108 2014-07-16 15:24:06Z guillaume $

%-Parameters of the response function%--------------------------------------------------------------------------p = [6 16 1 1 6 0 32];if nargin > 1 p(1:length(P)) = P;end

%-Microtime resolution%--------------------------------------------------------------------------if nargin > 2 fMRI_T = T;else fMRI_T = spm_get_defaults('stats.fmri.t');end

%-Modelled hemodynamic response function - {mixture of Gammas}%--------------------------------------------------------------------------dt = RT/fMRI_T;u = [0:ceil(p(7)/dt)] - p(6)/dt;hrf = spm_Gpdf(u,p(1)/p(3),dt/p(3)) - spm_Gpdf(u,p(2)/p(4),dt/p(4))/p(5);hrf = hrf([0:floor(p(7)/RT)]*fMRI_T + 1);hrf = hrf'/sum(hrf);

That’s it!

Page 33: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

>> hrf = spm_hrf(2)

hrf =

0 0.0866 0.3749 0.3849 0.2161 0.0769 0.0016 -0.0306 -0.0373 -0.0308 -0.0205 -0.0116 -0.0058 -0.0026 -0.0011 -0.0004 -0.0001

>> plot(hrf)

SPM Canonical HRF

Note: TR units! (TR = 2)

Page 34: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Derivatives

• Basis functions can be added together to explain fMRI time series

• SPM offers to expand the canonical HRF basis set with two additions:– Time derivative– Dispersion derivative(you can choose “none”, “time only”, or “time + dispersion”)

Page 35: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

SPM Time Derivative

Idea: shift the HRF earlier or later

This is implemented by a “+” bulge before the HRF peak and a “–” bulge after

(this shifts the HRF earlier; to shift later, can assign a negative weight)

stimulus

Page 36: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

SPM Dispersion Derivative

Idea: make the HRF wider or narrower

Implemented using two “–” bulges around the peak (and “+” in the center to compensate)

(this narrows the HRF; to widen, can assign a negative weight)

Page 37: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

SPM Derivatives

• The time derivative counters misalignment of HRF onset (subject/region has faster or slower HRF, or slice timing effects)

• The dispersion derivative counters shorter/longer HRFs

• However, note that “counter” here really means “model small deviations as a nuisance covariate”…

Page 38: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Time Derivative Advantages

• Lindquist et al. 2009:– Even minor misspecification of the HRF can

increase Type I error (bias and loss of power)– Derivative very accurate for small shifts (< 1 s),

progressively worse as shift increases

Calhoun et al. 2004:– TD reduces error variance in first level models

• Pernet 2014:– Using TD improved model R2

Page 39: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Time Derivative Concerns

Della-Maggiore et al. 2002, Calhoun et al. 2004:– Not so helpful for second level (group) analysis:

random effects models ignore first level variance– “Amplitude bias”: if HRF delay varies, different

voxels experience different “adjusted” HRF amplitudes (for >1s shifts especially)

• Pernet 2014:– Presence of derivative changes parameter estimates

for canonical HRF terms, sometimes drastically

Page 40: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Phew…

• Now we can estimate the model we set up

• This will generate certain output files, including images for each beta

Page 41: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Contrasts

• Once we have solved a GLM model, we have “betas” for variables (e.g., conditions)– SPM uses marginal (Type IV) sum-of-squares: each

term is estimated after accounting for all others– Or, put another way, condition order doesn’t matter

• Motor task model:– Left, right, rest conditions – Can test for individual effects (e.g. Left > 0)– Can test for differences (E.g. Left > Right)

Page 42: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Task Design Considerations

• How the task is organized has many implications for signal (and modeling)

• Ultimately, everything should be guided by the experimental question (see Task Design talk)

• Main options:– Blocked design: compare blocks of time– Event-related design: aggregate responses to

individual stimuli

Page 43: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Blocked vs. Event-Related Designs

• Because of HRF summation, blocks have high signal but low separability

• Can potentially separate stimulus responses (event related design)

D’Esposito 2000, Seminars in Neurology

Page 44: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Simple, “Slow” ER Design

Source:Andysbrainblog

Page 45: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

“Rapid” Event-Related Design

Source:Andysbrainblog

Fixed interval!

Page 46: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Randomized/Jittered Design

Source:Andysbrainblog

Variable interval

Page 47: FMRI Analysis Fundamentals With a focus on task-based analysis and SPM12

Power Spectrum View

• Periodic stimuli: power mainly at one freq.• Random stimuli: power spread out• Can think of the HRF “filtering” frequencies too;

only “slow” events end up having powerSource: The Clever Machine blog