Download - Bayesian Inference

Transcript
Page 1: Bayesian Inference

Bayesian Inference

Will Penny

SPM for fMRI Course,London, October 21st, 2010

Wellcome Centre for Neuroimaging, UCL, UK.

Page 2: Bayesian Inference

What is Bayesian Inference ?

(From Daniel Wolpert)

Page 3: Bayesian Inference

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

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

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

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

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

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

General Linear Model

eXy Model:

X

Page 10: Bayesian Inference

1

2

eXy Model:

Prior:

)2/exp(

),0()(

2

122

T

kk INp

Prior

Page 11: Bayesian Inference

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

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

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

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

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

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

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

SPM Interface

Page 19: Bayesian Inference

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

Sen

sitiv

ity

1-Specificity

ROC curve

Page 21: Bayesian Inference

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

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

Dynamic Causal Models

V1

V5

SPC

V5->SPC

Posterior Density

PriorsAre Physiological

Page 24: Bayesian Inference

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

Model Evidence

Bayes Rule:

)(

)|(),|(),(

myp

mpmypmyp

normalizing constant

dmpmypmyp )|(),|()(

Model evidence

Page 26: Bayesian Inference

( | ) ( )( | )

( )

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

( | ) ( )( | )

( )

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

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

Bayes Factors versus p-values

Two sample t-test

Subjects

Conditions

Page 30: Bayesian Inference

Bay

esia

n

Classical

p=0.05

BF=3

Page 31: Bayesian Inference

Bay

esia

n

Classical

BF=3

BF=20

Page 32: Bayesian Inference

Bay

esia

n

Classical

BF=3

BF=20

p=0.05

Page 33: Bayesian Inference

Bay

esia

n

Classical

BF=3

BF=20

p=0.05p=0.01

Page 34: Bayesian Inference

Model Evidence Revisited

dmpmypmyp )|(),|()(

)()(

)|(log

mcomplexitymaccuracy

myp

...)(

...)(2

02

2

1

mcomplexity

Zymaccuracy

Page 35: Bayesian Inference

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
Page 37: Bayesian Inference
Page 38: Bayesian Inference

Free Energy OptimisationInitial Point

Parameters,

Pre

cisi

ons,

Page 39: Bayesian Inference

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

-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

-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

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

Gibbs SamplingInitial Point

Assignments, A

Fre

quen

cies

, r

Stochastic Method

),|( YrAp

),|( yArp

Page 44: Bayesian Inference

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

-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

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

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

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
Page 50: Bayesian Inference
Page 51: Bayesian Inference

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

Primary visual cortex

ShortTime Scale

Long TimeScale

Frontal cortex

Computational fMRI: Harrison et al (in prep)

Page 53: Bayesian Inference

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

Primary visual cortex

ShortTime Scale

Long TimeScale

Frontal cortex

Double Dissociations

Page 55: Bayesian Inference

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