Whynhow McLaren Second Level - gate.nmr.mgh.harvard.edu
Transcript of Whynhow McLaren Second Level - gate.nmr.mgh.harvard.edu
The Fight Against Alzheimer’s Disease
Rules for Construc.ng and Repor.ng Second-‐level Sta.s.cs
Donald G. McLaren, Ph.D. GRECC, ERNM Veteran’s Hospital
Department of Neurology, MGH/HMS
hGp://www.mar.nos.org/~mclaren
02/16/2012
Financial Disclosures
• None.
MATLAB Basics
• Column Major (rows then columns) • * versus .* (. Can be used with many functions) • (),[],{} • Strings versus numbers • Variable Names are: a, a1, a3 not a(1) a(2) a{2} • = versus == • 4D data versus 2D processing • SPM • Nifti files
General Linear Model (GLM)
Y=aX+b
Brain Imaging
• The data: http://labs.jam3.ca/category/voxel-engine-
jam3-labs/
Brain Imaging
• From the beginning (almost)….
[ 5 6 7 5 ]
Analyses steps in the GLM
(1) Does an analysis of variance separately at each voxel
(2) Makes statistic from the results of this analysis, for each voxel
(3) Inferences
Converging Evidence of Func.onal Imaging in Alzheimer’s
(Buckner et al. 2005)
First-‐Level Analysis
BOLD Imaging
A
0Time'(TR)
40 80 120 160
0Time'(TR)
40 80 120 1600Time'(TR)
40 80 120 160
0Time'(TR)
40 80 120 160 0Time'(TR)
40 80 120 160
B
C D
F G
Signal'(a.u.)
Signal'(a.u.)
Signal'(a.u.)
Signal'(a.u.)
Signal'(a.u.)
0Time'(TR)
2 4 6 8
0Time'(TR)
40 80 120 160
E
Signal'(a.u.)
N
PV(self)
PV(sem)
fMRI Ac.vity
HueGel at al.
Ac.vity in the Brain
S.mulus
Hemodynam
ic Inverse Problem
(Adapted from Bucker 2003)
What Model Should I Use?
• Block Designs: Assume a Model • Event-Related Designs:
– FIR / No Assumed Model – Assume a Model + Derivatives – Assume a Model
Other Elements of the GLM
• AR(1) • Highpass filter • Mo.on correc.on factors • Excluding .mepoints
Quality Control
• Normaliza.on – Did it work? • Ar.facts – Check ResMS image or raw data? • Ac.vity – Do you get the expected ac.vity at the first level (visual cortex with visual s.muli)?
• Movement – TR to TR, overall movement
• Signal Spikes…
Second-‐Level Modeling
• These are all random effects (because of variance correc.ons and using beta’s from the first level)
• Mean across subjects divided by variance across subjects. – Low subjects with very low variance between them can lead to a significant finding, even if no subject was significant at the single subject level
– Implica.ons for analysis (e.g. SLBT??)
Types of Data – Dependent Variable
• Functional Connectivity – Correlation • Functional Connectivity -- ICA • Task Data
– Single Condition – Multiple Conditions – Multiple Predictors Per Condition
• Context-Dependent Connectivity • Other Types
Types of Data – Independent Variable
• Group • Behavioral Data
• Performance • Neuropsychological Scores • Emotional Scales
• Age • Total Brain Volume, Hippocampal Volume,
etc. • Images
The General Linear Model
npnpnnn
pp
pp
pp
xxxY
xxxYxxxYxxxY
εββββ
εββββ
εββββ
εββββ
+++++=
+++++=
+++++=
+++++=
,2,21,10
3,32,321,3103
2,22,221,2102
1,12,121,1101
εββββ +++++= ppXXXY 22110
=Y Y ε+observed = predicted + random error
Y = Xβ +εIn Matrix Form
Summary of the GLM
Y = X . β + ε
Observed data: SPM uses a mass univariate approach – that is each voxel is treated as a separate column vector of data. Y is the BOLD signal at various time points at a single voxel
Design matrix: Several components which explain the observed data, i.e. the BOLD time series for the voxel Timing info: onset vectors, Om
j, and duration vectors, Dmj
HRF, hm, describes shape of the expected BOLD response over time Other regressors, e.g. realignment parameters
Parameters: Define the contribution of each component of the design matrix to the value of Y Estimated so as to minimise the error, ε, i.e. least sums of squares
Error: Difference between the observed data, Y, and that predicted by the model, Xβ . Not assumed to be spherical in fMRI
Example •
Scan no Voxel 1 Taskdifficulty
1 57.84 52 57.58 43 57.14 44 55.15 25 55.90 36 55.67 17 58.14 68 55.82 39 55.10 110 58.65 611 56.89 512 55.69 2
X can contain values quantifying experimental variable
Y X
Parameters & error
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
Y = βx + c + ε
GLM • 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 are the
regressors you’re actually interested in
subjects
covariates
conditions: effects of interest
GLM – One Sample T-test
• load SPM.mat; figure; imagesc(SPM.xX.X)
GLM – One Sample T-test
GLM – Paired T-Test
GLM – Two Sample T-Test
• In SPM, the 1s will change if the variance is not equal and is set to unequal
GLM – Multiple Regression
x1 x2 c
GLM – Repeated Measures
GLM – Biological Parametric Mapping
Implementation MATLAB/SPM
Statistical Tests
• T-Test
• F-Test
Implementing the T-test
Variance Estimate
Sqrt(Var*cT(XTX)-1c)
c = +1 0 0 0 0 0 0 0
T =
contrast of estimated
parameters
t-test H0: cTβ = 0
variance estimate
Fixed Effects Magnitudes, Model-Free Example
• Using the numerator from the T-test, we get c*b as the magnitude of the effect. = c
= b
• c has the unique properties of summing to zero, and in certain cases c*cT is equal to 1. This is the basis for the problem, that will be shown in a few slides.
[ ] - 0.46159 -0.0949 .30717 .4317 .4578 .09565 -0.30571 -0.43014
- 0.13263 - 0.11653 .069775 .042275 .119375 .072575
- 0.02633 - 0.02853
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥Graphical Illustration of the contrast matrix
Fixed Effects Magnitudes, Model-Free Example
• Using the numerator from the T-test, we get c*b as the magnitude of the effect. = c
= b
[ ] - 0.46159 -0.0949 .30717 .4317 .4578 .09565 -0.30571 -0.43014
- 0.13263 - 0.11653 .069775 .042275 .119375 .072575
- 0.02633 - 0.02853
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥
Por.ons of the contrast matrix and the β coefficient matrix. represents a mul.plica.on of two matrix elements Add the products of the above mul.plica.on to obtain the magnitude.
Graphical Illustration of the contrast matrix
Fixed Effects Magnitudes, Model-Free Example
• Using the numerator from the T-test, we get c*b as the magnitude of the effect. = c
= b
[ ] - 0.46159 -0.0949 .30717 .4317 .4578 .09565 -0.30571 -0.43014
- 0.13263 - 0.11653 .069775 .042275 .119375 .072575
- 0.02633 - 0.02853
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥
Por.ons of the contrast matrix and the β coefficient matrix. represents a mul.plica.on of two matrix elements Add the products of the above mul.plica.on to obtain the magnitude.
Graphical Illustration of the contrast matrix
Fixed Effects Magnitudes, Model-Free Example
• Using the numerator from the T-test, we get c*b as the magnitude of the effect. = c
= b
[ ] - 0.46159 -0.0949 .30717 .4317 .4578 .09565 -0.30571 -0.43014
- 0.13263 - 0.11653 .069775 .042275 .119375 .072575
- 0.02633 - 0.02853
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥
Por.ons of the contrast matrix and the β coefficient matrix. represents a mul.plica.on of two matrix elements Add the products of the above mul.plica.on to obtain the magnitude.
Graphical Illustration of the contrast matrix
Fixed Effects Magnitudes, Model-Free Example
• Using the numerator from the T-test, we get c*b as the magnitude of the effect. = c
= b
[ ] - 0.46159 -0.0949 .30717 .4317 .4578 .09565 -0.30571 -0.43014
- 0.13263 - 0.11653 .069775 .042275 .119375 .072575
- 0.02633 - 0.02853
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥
Por.ons of the contrast matrix and the β coefficient matrix. represents a mul.plica.on of two matrix elements Add the products of the above mul.plica.on to obtain the magnitude.
Graphical Illustration of the contrast matrix
Fixed Effects Magnitudes, Model-Free Example
• Using the numerator from the T-test, we get c*b as the magnitude of the effect. = c
= b
[ ] - 0.46159 -0.0949 .30717 .4317 .4578 .09565 -0.30571 -0.43014
- 0.13263 - 0.11653 .069775 .042275 .119375 .072575
- 0.02633 - 0.02853
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥
Por.ons of the contrast matrix and the β coefficient matrix. represents a mul.plica.on of two matrix elements Add the products of the above mul.plica.on to obtain the magnitude.
Graphical Illustration of the contrast matrix
Fixed Effects Magnitudes, Model-Free Example
• Using the numerator from the T-test, we get c*b as the magnitude of the effect. = c
= b
[ ] - 0.46159 -0.0949 .30717 .4317 .4578 .09565 -0.30571 -0.43014
- 0.13263 - 0.11653 .069775 .042275 .119375 .072575
- 0.02633 - 0.02853
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥
Por.ons of the contrast matrix and the β coefficient matrix. represents a mul.plica.on of two matrix elements Add the products of the above mul.plica.on to obtain the magnitude.
Graphical Illustration of the contrast matrix
Fixed Effects Magnitudes, Model-Free Example
• Using the numerator from the T-test, we get c*b as the magnitude of the effect. = c
= b
[ ] - 0.46159 -0.0949 .30717 .4317 .4578 .09565 -0.30571 -0.43014
- 0.13263 - 0.11653 .069775 .042275 .119375 .072575
- 0.02633 - 0.02853
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥
Por.ons of the contrast matrix and the β coefficient matrix. represents a mul.plica.on of two matrix elements Add the products of the above mul.plica.on to obtain the magnitude.
Graphical Illustration of the contrast matrix
Fixed Effects Magnitudes, Model-Free Example
• Using the numerator from the T-test, we get c*b as the magnitude of the effect. = c
= b
[ ] - 0.46159 -0.0949 .30717 .4317 .4578 .09565 -0.30571 -0.43014
- 0.13263 - 0.11653 .069775 .042275 .119375 .072575
- 0.02633 - 0.02853
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥
Por.ons of the contrast matrix and the β coefficient matrix. represents a mul.plica.on of two matrix elements Add the products of the above mul.plica.on to obtain the magnitude.
Graphical Illustration of the contrast matrix
Fixed Effects Magnitudes, Model-Free Example
• Using the numerator from the T-test, we get c*b as the magnitude of the effect. = c
= b
[ ] - 0.46159 -0.0949 .30717 .4317 .4578 .09565 -0.30571 -0.43014
- 0.13263 - 0.11653 .069775 .042275 .119375 .072575
- 0.02633 - 0.02853
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥
Por.ons of the contrast matrix and the β coefficient matrix. represents a mul.plica.on of two matrix elements Add the products of the above mul.plica.on to obtain the magnitude.
Graphical Illustration of the contrast matrix
Fixed Effects Magnitudes, Model-Free Example
• Using the numerator from the T-test, we get c*b as the magnitude of the effect. = c
= b
• c has the unique properties of summing to zero, and in certain cases c*cT is equal to 1.
[ ] - 0.46159 -0.0949 .30717 .4317 .4578 .09565 -0.30571 -0.43014
- 0.13263 - 0.11653 .069775 .042275 .119375 .072575
- 0.02633 - 0.02853
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥
Por.ons of the contrast matrix and the β coefficient matrix. represents a mul.plica.on of two matrix elements Add the products of the above mul.plica.on to obtain the magnitude.
Graphical Illustration of the contrast matrix
Implementing the F-test
F = error
variance estimate
additional variance
accounted for by effects of
interest
0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1
H0: cTβ = 0 c =
T/r/F Notes
• If F is a single row contrast, then F=T^2 • There are formulas to convert between T/r and other sta.s.cs (e.g. cohen’s d)
Constructing Contrasts
Construc.ng Contrasts
• What is the null hypothesis?
• Make the null hypothesis equal to 0
• Label the columns based on the weigh.ng of the components of the null hypothesis – For repeated measures, form the sub-‐elements of the contrast, then apply the weights
Constructing Contrasts • S1G1C1: [1 zeros(1,10) 1 0 1 0 0 1 0 0 0 0 0] • S1G1C2: [1 zeros(1,10) 1 0 0 1 0 0 1 0 0 0 0] • S2G1C1: [0 1 zeros(1,9) 1 0 1 0 0 1 0 0 0 0 0] • G1: [ones(1,6)/6 zeros(1,5) 1 0 1/3 1/3 1/3 1/3 1/3 1/3 0 0 0] • G1vsG2: [ones(1,6)/6 ones(1,5)/5 1 -1 0 0 0 1/3 1/3 1/3 -1/3 -1/3
-1/3]
Implementation MATLAB/SPM
Caveat 1: What is analyzed…
• Missing Data – NaN – Zeros
Caveat 2: Designs
• Between-subject Designs
• Within-subject Designs
• Mixed Designs
Variance Correc.ons
• The issue of non-‐sphericity
Repeated Measures in FSL
• Limited to designs that have no viola.ons of sphericity.
Mixed Designs
• Only look at within-‐subject effects
Mixed Designs in FSL
Along with the general caveats, you can not use randomise with mixed designs.
Covariates
• If you have a single group: – Demeaning covariate will not change the slope – Demeaning makes the group term the mean of the group; whereas not demeaning makes the group term the intercept.
Covariates
• If you have a mul.ple groups: – Demeaning covariate will not change the slope, no maGer how you demean it
– Demeaning within each group à controlling for the covariate, but group means are uneffected
– Demeaning across everyone à controlling for the covariate, but group means are effected. If you do this, you should refer to group tests as a comparison of covariate-‐adjusted means
Inferences
Inferences
• Cluster – AlphaSim – Extent Threshold – SPM8b – False Discovery Rate
• Voxel – False Discovery Rate (FDR) – Family-wise Error Correction (FWE)
Inferences – AlphaSim/Extent
• Generate X random sets of p-values, smooth them, count the number of voxels in the largest cluster in each set.
• Determine how many voxels are in the largest clusters X% of the time to find the threshold
• Use the result for the extent threshold
Inferences – AlphaSim/Extent Data set dimensions: nx = 100 ny = 100 nz = 25 (voxels) dx = 4.00 dy = 4.00 dz = 4.00 (mm) Gaussian filter widths: sigmax = 0.00 FWHMx = 0.00 sigmay = 0.00 FWHMy = 0.00 sigmaz = 0.00 FWHMz = 0.00 Cluster connec.on = Nearest Neighbor Threshold probability: pthr = 5.000000e-‐03 Number of Monte Carlo itera.ons = 1000 Cl Size Frequency CumuProp p/Voxel Max Freq Alpha 1 1213114 0.985345 0.00499870 0 1.000000 2 17579 0.999623 0.00014624 626 1.000000 3 454 0.999992 0.00000561 364 0.374000 4 10 1.000000 0.00000016 10 0.010000
Inferences -- FDR
• q% of significant voxels are false positives
• Rank all p-values • Find max(i) such that pi ≤ i/V*q
– V is search space
Inferences -- FDR
p(i)
i/V i/V × q
0 1
0 1
Topological FDR
• Correc.on for the expected number of peaks or clusters using the false discovery rate.
The Search Space
• How many voxels (resels) are you tes.ng • resels – resolu.on elements
Finding Clusters and Peaks [voxels voxelstats clusterstats regions mapparameters UID] =peak_nii(‘myimage.nii’,mapparameters) UID -‐-‐ This was added to allow the user to add a unique ID to the analysis. If this field is not specified, then the default will be a .mestamp (e.g. _20111108T150137). To avoid the using a .mestamp, set this field to ‘’. sign -‐-‐ This can either be ‘pos’ or ‘neg. This specifies the direc.on of the contrast to test. If not specified, the program will default to ‘pos’. NOTE: F-‐contrasts can only be posi.ve. thresh -‐-‐ This specifies the voxel threshold for finding clusters. This is only op.onal because the program will default to a value of 0. The threshold has to be a number and can either be the T/F sta.s.c, a p-‐value, or any other number. This should almost always be specified. type -‐-‐ This specifies the sta.s.c type, 'T', 'F', ‘Z’, or 'none'. cluster -‐-‐ This specifies the minimum cluster size required to keep a cluster in the results. The default is 0. This is BAD!!!. df1 -‐-‐The numerator degrees of freedom for T/F-‐test df2 -‐-‐The denominator degrees of freedom for F-‐test. label-‐-‐ This specifies which labeling scheme to use.
OrthoView
What to report in papers
• Be explicit about the model – What are the factors – What are the covariates – What did you set as the variance and dependence for each factor
• Be explicit about the contrast you are using • Be explicit about how to interpret the contrast
– Group means, group intercepts, covariate adjusted group means
• Be explicit about the thresholds used – Correc.ons for mul.ple comparisons – Small Volume Correc.on (corrected in SPM8 in late Feb. 2012)
Acknowledgements • Harvard Aging Brain Project
– Dr. Reisa Sperling – Dr. Alireza Atri – Dr. Aaron Schultz – Aishwarya Sreenivasan – Andrew Ward – Dr. Koene Van Dijk – Dr. Willem Huijbers – Dr. Dorene Rentz – Dr. Trey Hedden
• Dr. Darren Gitelman • Jus.n Vincent • Dr. Bob Spunt • Wisconsin Alzheimer’s
Disease Research Center
– Imaging Core (Dr. Sterling Johnson, Dr. Michele Ries, Dr. Guofan Xu, Elisa Canu, Erik Kastman)
– Dr. Mark Sager – Dr. Sanjay Asthana
• Mark McAvoy • Tim Hess • Ron Serlin
Useful Mailing Lists • SPM – hGp://www.jiscmail.ac.uk/list/spm.html
• FSL -‐-‐ hGp://www.jiscmail.ac.uk/list/fsl.html
• Freesurfer -‐-‐ hGp://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurferSupport
• CARET -‐-‐ hGp://brainvis.wustl.edu/wiki/index.php/Caret:Mailing_List
• I highly recommend reading the posts on these lists as they will save you .me in the future.
Open Neuroscience