Bayesian Inference
description
Transcript of Bayesian Inference
![Page 1: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/1.jpg)
Bayesian Inference
Will Penny
SPM for fMRI Course,London, October 21st, 2010
Wellcome Centre for Neuroimaging, UCL, UK.
![Page 2: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/2.jpg)
What is Bayesian Inference ?
(From Daniel Wolpert)
![Page 3: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/3.jpg)
realignmentrealignment smoothingsmoothing
normalisationnormalisation
general linear modelgeneral linear model
templatetemplate
Gaussian Gaussian field theoryfield theory
p <0.05p <0.05
statisticalstatisticalinferenceinference
Bayesian segmentationand normalisation
Bayesian segmentationand normalisation
![Page 4: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/4.jpg)
realignmentrealignment smoothingsmoothing
normalisationnormalisation
general linear modelgeneral linear model
templatetemplate
Gaussian Gaussian field theoryfield theory
p <0.05p <0.05
statisticalstatisticalinferenceinference
Bayesian segmentationand normalisation
Bayesian segmentationand normalisation
Smoothnessmodelling
Smoothnessmodelling
![Page 5: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/5.jpg)
realignmentrealignment smoothingsmoothing
normalisationnormalisation
general linear modelgeneral linear model
templatetemplate
Gaussian Gaussian field theoryfield theory
p <0.05p <0.05
statisticalstatisticalinferenceinference
Bayesian segmentationand normalisation
Bayesian segmentationand normalisation
Smoothnessestimation
Smoothnessestimation
Posterior probabilitymaps (PPMs)
Posterior probabilitymaps (PPMs)
![Page 6: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/6.jpg)
realignmentrealignment smoothingsmoothing
normalisationnormalisation
general linear modelgeneral linear model
templatetemplate
Gaussian Gaussian field theoryfield theory
p <0.05p <0.05
statisticalstatisticalinferenceinference
Bayesian segmentationand normalisation
Bayesian segmentationand normalisation
Smoothnessestimation
Smoothnessestimation
Dynamic CausalModelling
Dynamic CausalModelling
Posterior probabilitymaps (PPMs)
Posterior probabilitymaps (PPMs)
![Page 7: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/7.jpg)
Overview
• Parameter Inference– GLMs, PPMs, DCMs
• Model Inference– Model Evidence, Bayes factors (cf. p-values)
• Model Estimation– Variational Bayes
• Groups of subjects– RFX model inference, PPM model inference
![Page 8: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/8.jpg)
Overview
• Parameter Inference– GLMs, PPMs, DCMs
• Model Inference– Model Evidence, Bayes factors (cf. p-values)
• Model Estimation– Variational Bayes
• Groups of subjects– RFX model inference, PPM model inference
![Page 9: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/9.jpg)
General Linear Model
eXy Model:
X
![Page 10: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/10.jpg)
1
2
eXy Model:
Prior:
)2/exp(
),0()(
2
122
T
kk INp
Prior
![Page 11: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/11.jpg)
Sample curves from prior (before observing any data)
Mean curve
x
Z
1
2
eXy Model:
Prior:
)2/exp(
),0()(
2
122
T
kk INp
Prior
![Page 12: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/12.jpg)
1
2
Priors and likelihood
1
2
)2/)(exp(
),(),(
),|(),(
21
111
1
111
ii
ii
N
ii
Xy
XNyp
ypyp
eXy Model:
Prior:
)2/exp(
),0()(
2
122
T
kk INp
Likelihood:
x
X
![Page 13: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/13.jpg)
1
2
eXy Model:
Prior:
)2/exp(
),0()(
2
122
T
kk INp
Likelihood:
)2/)(exp(
),(),(
),|(),(
21
111
1
111
ii
ii
N
ii
Xy
XNyp
ypyp
x
X
Priors and likelihood
![Page 14: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/14.jpg)
yCX
IXXC
CNyp
T
kT
1
1
21
, ,|
x
X
eXy Model:
Prior:
)2/exp(
),0()(
2
122
T
kk INp
Likelihood:
Bayes Rule:
)|(),|(),( pypyp
Posterior:
N
iiypyp
111 ),|(),(
1
2
Posterior after one observation
![Page 15: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/15.jpg)
1
2
x
X
yCX
IXXC
CNyp
T
kT
1
1
21
, ,|
eXy Model:
Prior:
)2/exp(
),0()(
2
122
T
kk INp
Likelihood:
Bayes Rule:
)|(),|(),( pypyp
Posterior:
N
iiypyp
111 ),|(),(
Posterior after two observations
![Page 16: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/16.jpg)
1
2
yCX
IXXC
CNyp
T
kT
1
1
21
, ,|
eXy Model:
Prior:
)2/exp(
),0()(
2
122
T
kk INp
Likelihood:
Bayes Rule:
)|(),|(),( pypyp
Posterior:
N
iiypyp
111 ),|(),(
Posterior after eight observations
x
X
![Page 17: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/17.jpg)
Overview
• Parameter Inference– GLMs, PPMs, DCMs
• Model Inference– Model Evidence, Bayes factors (cf. p-values)
• Model Estimation– Variational Bayes
• Groups of subjects– RFX model inference, PPM model inference
![Page 18: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/18.jpg)
SPM Interface
![Page 19: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/19.jpg)
AR coeff(correlated noise)
prior precisionof AR coeff
A
Bayesian ML
aMRI Smooth Y (RFT)
Posterior Probability Maps
observations
GLM
prior precisionof GLM coeff
Observation noise
Y
112,0 LNp XY
![Page 20: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/20.jpg)
Sen
sitiv
ity
1-Specificity
ROC curve
![Page 21: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/21.jpg)
Mean (Cbeta_*.img)
Std dev (SDbeta_*.img)
activation threshold
ths
Posterior density
Probability mass p
probability of getting an effect, given the dataprobability of getting an effect, given the data
),()( nnn Nq mean: size of effectcovariance: uncertainty
thpp
Display only voxels that exceed e.g. 95%Display only voxels that exceed e.g. 95%
PPM (spmP_*.img)
Posterior Probability Maps
![Page 22: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/22.jpg)
Overview
• Parameter Inference– GLMs, PPMs, DCMs
• Model Inference– Model Evidence, Bayes factors (cf. p-values)
• Model Estimation– Variational Bayes
• Groups of subjects– RFX model inference, PPM model inference
![Page 23: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/23.jpg)
Dynamic Causal Models
V1
V5
SPC
V5->SPC
Posterior Density
PriorsAre Physiological
![Page 24: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/24.jpg)
Overview
• Parameter Inference– GLMs, PPMs, DCMs
• Model Inference– Model Evidence, Bayes factors (cf. p-values)
• Model Estimation– Variational Bayes
• Groups of subjects– RFX model inference, PPM model inference
![Page 25: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/25.jpg)
Model Evidence
Bayes Rule:
)(
)|(),|(),(
myp
mpmypmyp
normalizing constant
dmpmypmyp )|(),|()(
Model evidence
![Page 26: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/26.jpg)
( | ) ( )( | )
( )
p m p mp m
p
yy
y
PriorPosterior EvidenceModel Model Bayes factor:
( | )
( | )ij
p m iB
p m j
y
y
V1
V5
SPC
V1
V5
SPC
Model, m=i Model, m=j
![Page 27: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/27.jpg)
( | ) ( )( | )
( )
p m p mp m
p
yy
y
PriorPosterior EvidenceModel Model Bayes factor:
( | )
( | )ij
p m iB
p m j
y
y
For EqualModelPriors
![Page 28: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/28.jpg)
Overview
• Parameter Inference– GLMs, PPMs, DCMs
• Model Inference– Model Evidence, Bayes factors (cf. p-values)
• Model Estimation– Variational Bayes
• Groups of subjects– RFX model inference, PPM model inference
![Page 29: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/29.jpg)
Bayes Factors versus p-values
Two sample t-test
Subjects
Conditions
![Page 30: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/30.jpg)
Bay
esia
n
Classical
p=0.05
BF=3
![Page 31: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/31.jpg)
Bay
esia
n
Classical
BF=3
BF=20
![Page 32: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/32.jpg)
Bay
esia
n
Classical
BF=3
BF=20
p=0.05
![Page 33: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/33.jpg)
Bay
esia
n
Classical
BF=3
BF=20
p=0.05p=0.01
![Page 34: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/34.jpg)
Model Evidence Revisited
dmpmypmyp )|(),|()(
)()(
)|(log
mcomplexitymaccuracy
myp
...)(
...)(2
02
2
1
mcomplexity
Zymaccuracy
![Page 35: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/35.jpg)
Overview
• Parameter Inference– GLMs, PPMs, DCMs
• Model Inference– Model Evidence, Bayes factors (cf. p-values)
• Model Estimation– Variational Bayes
• Groups of subjects– RFX model inference, PPM model inference
![Page 36: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/36.jpg)
![Page 37: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/37.jpg)
![Page 38: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/38.jpg)
Free Energy OptimisationInitial Point
Parameters,
Pre
cisi
ons,
![Page 39: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/39.jpg)
Overview
• Parameter Inference– GLMs, PPMs, DCMs
• Model Inference– Model Evidence, Bayes factors (cf. p-values)
• Model Estimation– Variational Bayes
• Groups of subjects– RFX model inference, PPM model inference
![Page 40: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/40.jpg)
-5 -4 -3 -2 -1 0 1 2 3 4 5
Sim
ulat
ed d
ata
sets
Log model evidence differences
x1 x2u1
x3
u2
x1 x2u1
x3
u2
incorrect model (m2) correct model (m1)
Figure 2
m2 m1
![Page 41: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/41.jpg)
-35 -30 -25 -20 -15 -10 -5 0 5
Sub
ject
s
Log model evidence differences
MOG
LG LG
RVFstim.
LVFstim.
FGFG
LD|RVF
LD|LVF
LD LD
MOGMOG
LG LG
RVFstim.
LVFstim.
FGFG
LD
LD
LD|RVF LD|LVF
MOG
m2 m1
Models from Klaas Stephan
![Page 42: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/42.jpg)
1 2 3 4 5 60
0.2
0.4
0.6
0.8
r
Models
A
Models
Sub
ject
s
1 2 3 4 5 6
5
10
15
20
log p(y|a)log p(yn|m)
Random Effects (RFX) Inference
![Page 43: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/43.jpg)
Gibbs SamplingInitial Point
Assignments, A
Fre
quen
cies
, r
Stochastic Method
),|( YrAp
),|( yArp
![Page 44: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/44.jpg)
log p(y|a)log p(yn|m)
)(
]log)|(exp[log
''
nn
mnm
nmnm
mnnm
gMulta
u
ug
rmypu
)(
0
Dirr
an
nmmm
),|( YrAp
),|( yArp
GibbsSampling
![Page 45: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/45.jpg)
-35 -30 -25 -20 -15 -10 -5 0 5
Sub
ject
s
Log model evidence differences
MOG
LG LG
RVFstim.
LVFstim.
FGFG
LD|RVF
LD|LVF
LD LD
MOGMOG
LG LG
RVFstim.
LVFstim.
FGFG
LD
LD
LD|RVF LD|LVF
MOG
m2 m1
11/12=0.92
![Page 46: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/46.jpg)
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
r1
p(r 1
|y)
p(r1>0.5 | y) = 0.997
843.01 r
![Page 47: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/47.jpg)
Overview
• Parameter Inference– GLMs, PPMs, DCMs
• Model Inference– Model Evidence, Bayes factors (cf. p-values)
• Model Estimation– Variational Bayes
• Groups of subjects– RFX model inference, PPM model inference
![Page 48: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/48.jpg)
PPMs for Models
)()(log qFmyp
Compute log-evidence for each model/subjectCompute log-evidence for each model/subject
model 1model 1
model Kmodel K
subject 1subject 1
subject Nsubject N
Log-evidence mapsLog-evidence maps
![Page 49: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/49.jpg)
![Page 50: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/50.jpg)
![Page 51: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/51.jpg)
kr
k
BMS mapsBMS maps
PPMPPM
EPMEPM
)()(log qFmyp
Compute log-evidence for each model/subjectCompute log-evidence for each model/subject
model 1model 1
model Kmodel K
subject 1subject 1
subject Nsubject N
Log-evidence mapsLog-evidence maps
)( krq
kr
941.0)5.0( krq
Probability that model k generated data
Probability that model k generated data
PPMs for Models
Rosa et al Neuroimage, 2009
![Page 52: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/52.jpg)
Primary visual cortex
ShortTime Scale
Long TimeScale
Frontal cortex
Computational fMRI: Harrison et al (in prep)
![Page 53: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/53.jpg)
Non-nested versus nested comparison
Non-nested:
Compare model A versus model B
Nested:
Compare model A versus model AB
For detecting model B:
Penny et al, HBM,2007
![Page 54: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/54.jpg)
Primary visual cortex
ShortTime Scale
Long TimeScale
Frontal cortex
Double Dissociations
![Page 55: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/55.jpg)
Summary
• Parameter Inference– GLMs, PPMs, DCMs
• Model Inference– Model Evidence, Bayes factors (cf. p-values)
• Model Estimation– Variational Bayes
• Groups of subjects– RFX model inference, PPM model inference
![Page 56: Bayesian Inference](https://reader033.fdocuments.us/reader033/viewer/2022061602/568144de550346895db1a9c6/html5/thumbnails/56.jpg)