06_MEEG_Bayes_Inference - Wellcome Trust Centre for

advertisement
Bayesian Inference
Chris Mathys
Wellcome Trust Centre for Neuroimaging
UCL
SPM Course (M/EEG)
London, May 14, 2013
Thanks to Jean Daunizeau and Jérémie Mattout for
previous versions of this talk
A spectacular piece of information
May 14, 2013
2
A spectacular piece of information
Messerli, F. H. (2012). Chocolate Consumption, Cognitive Function, and Nobel Laureates.
New England Journal of Medicine, 367(16), 1562–1564.
May 14, 2013
3
So will I win the Nobel prize if I eat lots of chocolate?
This is a question referring to uncertain quantities. Like almost all scientific
questions, it cannot be answered by deductive logic. Nonetheless, quantitative
answers can be given – but they can only be given in terms of probabilities.
Our question here can be rephrased in terms of a conditional probability:
𝑝 𝑁𝑜𝑏𝑒𝑙 𝑐ℎ𝑜𝑐𝑜𝑙𝑎𝑡𝑒 = ?
To answer it, we have to learn to calculate such quantities. The tool to do that is
Bayesian inference.
May 14, 2013
4
«Bayesian» = logical
and
logical = probabilistic
«The actual science of logic is conversant at present only with things either
certain, impossible, or entirely doubtful, none of which (fortunately) we have to
reason on. Therefore the true logic for this world is the calculus of probabilities,
which takes account of the magnitude of the probability which is, or ought to
be, in a reasonable man's mind.»
— James Clerk Maxwell, 1850
May 14, 2013
5
«Bayesian» = logical
and
logical = probabilistic
But in what sense is probabilistic reasoning (i.e., reasoning about uncertain
quantities according to the rules of probability theory) «logical»?
R. T. Cox showed in 1946 that the rules of probability theory can be derived
from three basic desiderata:
1. Representation of degrees of plausibility by real numbers
2. Qualitative correspondence with common sense (in a well-defined sense)
3. Consistency
May 14, 2013
6
The rules of probability
By mathematical proof (i.e., by deductive reasoning) the three desiderata as set out by
Cox imply the rules of probability (i.e., the rules of inductive reasoning).
This means that anyone who accepts the desiderata as must accept the following rules:
1.
𝑎𝑝
2.
𝑝 𝑏 =
3.
𝑝 𝑎, 𝑏 = 𝑝 𝑎 𝑏 𝑝 𝑏 = 𝑝 𝑏 𝑎 𝑝 𝑎
(Normalization)
𝑎 =1
𝑎𝑝
𝑎, 𝑏
(Marginalization – also called the sum rule)
(Conditioning – also called the product rule)
«Probability theory is nothing but common sense reduced to calculation.»
— Pierre-Simon Laplace, 1819
May 14, 2013
7
Conditional probabilities
The probability of 𝑎 given 𝑏 is denoted by
𝑝 𝑎𝑏 .
In general, this is different from the probability of 𝑎 alone (the marginal probability of
𝑎), as we can see by applying the sum and product rules:
𝑝 𝑎 =
𝑝 𝑎, 𝑏 =
𝑏
𝑝 𝑎𝑏 𝑝 𝑏
𝑏
Because of the product rule, we also have the following rule (Bayes’ theorem) for
going from 𝑝 𝑎 𝑏 to 𝑝 𝑏 𝑎 :
𝑝 𝑏𝑎 =
May 14, 2013
𝑝 𝑎𝑏 𝑝 𝑏
=
𝑝 𝑎
𝑝 𝑎𝑏 𝑝 𝑏
𝑏′ 𝑝 𝑎 𝑏′ 𝑝 𝑏′
8
The chocolate example
In our example, it is immediately clear that 𝑃 𝑁𝑜𝑏𝑒𝑙 𝑐ℎ𝑜𝑐𝑜𝑙𝑎𝑡𝑒 is very different from
𝑃 𝑐ℎ𝑜𝑐𝑜𝑙𝑎𝑡𝑒 𝑁𝑜𝑏𝑒𝑙 . While the first is hopeless to determine directly, the second is
much easier to assess: ask Nobel laureates how much chocolate they eat. Once we know
that, we can use Bayes’ theorem:
posterior
likelihood
model
𝑝 𝑐ℎ𝑜𝑐𝑜𝑙𝑎𝑡𝑒 𝑁𝑜𝑏𝑒𝑙 𝑃 𝑁𝑜𝑏𝑒𝑙
𝑝 𝑁𝑜𝑏𝑒𝑙 𝑐ℎ𝑜𝑐𝑜𝑙𝑎𝑡𝑒 =
𝑝 𝑐ℎ𝑜𝑐𝑜𝑙𝑎𝑡𝑒
prior
evidence
Inference on the quantities of interest in M/EEG studies has exactly the same general
structure.
May 14, 2013
9
Inference in M/EEG
forward problem
𝑝 đ‘Ļ 𝜗, 𝑚
likelihood
posterior distribution
𝑝 𝜗 đ‘Ļ, 𝑚
inverse problem
May 14, 2013
10
Inference in M/EEG
Likelihood:
𝑝 đ‘Ļ 𝜗, 𝑚
Prior:
𝑝 𝜗𝑚
Bayes’ theorem:
𝑝 đ‘Ļ 𝜗, 𝑚 𝑝 𝜗 𝑚
𝑝 𝜗 đ‘Ļ, 𝑚 =
𝑝 đ‘Ļ𝑚
īą
generative model 𝑚
May 14, 2013
11
A simple example of Bayesian inference
(adapted from Jaynes (1976))
Two manufacturers, A and B, deliver the same kind of components that turn out to
have the following lifetimes (in hours):
A:
B:
Assuming prices are comparable, from which manufacturer would you buy?
May 14, 2013
12
A simple example of Bayesian inference
How do we compare such samples?
• By comparing their arithmetic means
Why do we take means?
• If we take the mean as our estimate, the error in our estimate is the mean of the
errors in the individual measurements
• Taking the mean as maximum-likelihood estimate implies a Gaussian error
distribution
• A Gaussian error distribution appropriately reflects our prior knowledge about
the errors whenever we know nothing about them except perhaps their variance
May 14, 2013
13
A simple example of Bayesian inference
What next?
• Let’s do a t-test:
not significant!
Is this satisfactory?
• No, so what can we learn by turning to probability theory (i.e., Bayesian
inference)?
May 14, 2013
14
A simple example of Bayesian inference
The procedure in brief:
• Determine your question of interest («What is the probability that...?»)
• Specify your model (likelihood and prior)
• Calculate the full posterior using Bayes’ theorem
• [Pass to the uninformative limit in the parameters of your prior]
• Integrate out any nuisance parameters
• Ask your question of interest of the posterior
All you need is the rules of probability theory.
(Ok, sometimes you’ll encounter a nasty integral – but that’s a technical difficulty,
not a conceptual one).
May 14, 2013
15
A simple example of Bayesian inference
The question:
• What is the probability that the components from manufacturer B
have a longer lifetime than those from manufacturer A?
• More specifically: given how much more expensive they are, how
much longer do I require the components from B to live.
• Example of a decision rule: if the components from B live 3 hours
longer than those from A with a probability of at least 80%, I will
choose those from B.
May 14, 2013
16
A simple example of Bayesian inference
The model:
• likelihood (Gaussian):
𝑛
𝑝 đ‘Ĩ𝑖 𝜇, 𝜆 =
𝑖=1
𝜆
2𝜋
1
2
𝜆
exp − đ‘Ĩ𝑖 − 𝜇
2
2
• prior (Gaussian-gamma):
𝑝 𝜇, 𝜆 𝜇0 , 𝑎0 , 𝑏0 = 𝒩 𝜇 𝜇0 , 𝜅0 𝜆
May 14, 2013
−1
Gam 𝜆 𝑎0 , 𝑏0
17
A simple example of Bayesian inference
The posterior (Gaussian-gamma):
𝑝 𝜇, 𝜆 đ‘Ĩ𝑖
= 𝒩 𝜇 𝜇𝑛 , 𝜅𝑛 𝜆
−1
Gam 𝜆 𝑎𝑛 , 𝑏𝑛
Parameter updates:
𝜇𝑛 = 𝜇0 +
𝑛
đ‘Ĩ − 𝜇0 ,
𝜅0 + 𝑛
𝑏𝑛 = 𝑏0 +
đ‘Ĩ≔
1
𝑛
𝑛
đ‘Ĩ𝑖 ,
𝑖=1
May 14, 2013
𝑠2 ≔
1
𝑛
𝜅𝑛 = 𝜅0 + 𝑛,
𝑛 2
𝜅0
𝑠 +
đ‘Ĩ − 𝜇0
2
𝜅0 + 𝑛
𝑎𝑛 = 𝑎0 +
𝑛
2
2
with
𝑛
đ‘Ĩ𝑖 − đ‘Ĩ
2
𝑖=1
18
A simple example of Bayesian inference
The limit for which the prior becomes uninformative:
• For 𝜅0 = 0, 𝑎0 = 0, 𝑏0 = 0, the updates reduce to:
𝜇𝑛 = đ‘Ĩ
𝜅𝑛 = 𝑛
𝑎𝑛 =
𝑏𝑛 =
𝑛
2
𝑛 2
𝑠
2
• This means that only the data influence the posterior and all influence from
the parameters of the prior has been eliminated.
• This limit should only ever be taken after the calculation of the posterior using
a proper prior.
May 14, 2013
19
A simple example of Bayesian inference
Integrating out the nuisance parameter 𝜆 gives rise to a tdistribution:
May 14, 2013
20
A simple example of Bayesian inference
The joint posterior 𝑝 𝜇𝐴 , 𝜇đĩ đ‘Ĩ𝑖 𝐴 , đ‘Ĩ𝑘
of
our
𝑝 𝜇đĩ đ‘Ĩ𝑘
two
đĩ
independent
đĩ
is simply the product
posteriors
𝑝 𝜇𝐴 đ‘Ĩ𝑖
𝐴
and
. It will now give us the answer to our question:
∞
𝑝 𝜇đĩ − 𝜇𝐴 > 3 =
∞
d𝜇𝐴 𝑝 𝜇𝐴 đ‘Ĩ𝑖
−∞
d𝜇đĩ 𝑝 𝜇đĩ đ‘Ĩ𝑘
𝐴
đĩ
= 0.9501
𝜇𝐴 +3
Note that the t-test told us that there was «no significant
difference» even though there is a >95% probability that the
parts from B will last 3 hours longer than those from A.
May 14, 2013
21
Bayesian inference
The procedure in brief:
• Determine your question of interest («What is the probability that...?»)
• Specify your model (likelihood and prior)
• Calculate the full posterior using Bayes’ theorem
• [Pass to the uninformative limit in the parameters of your prior]
• Integrate out any nuisance parameters
• Ask your question of interest of the posterior
All you need is the rules of probability theory.
May 14, 2013
22
Frequentist (or: orthodox, classical) versus
Bayesian inference: parameter estimation
Classical
Bayesian
• define the null, e.g.: đģ0 : 𝜗 = 0
• invert model (obtain posterior pdf)
𝑝 𝑡 đģ0
𝑝 𝜗đ‘Ļ
P ī€¨ H0 y ī€Š ī‚ŗ īĄ
𝑝 𝑡>
𝑡∗
𝑡∗
𝑝 đģ0 đ‘Ļ
đģ0
īą
𝑡≡𝑡 𝑌
• estimate parameters (obtain test stat.)
• define the null, e.g.:
• apply decision rule, i.e.:
• apply decision rule, i.e.:
if 𝑝 𝑡 > 𝑡 ∗ đģ0 ≤ đ›ŧ then reject H0
May 14, 2013
đģ0 : 𝜗 > 0
if 𝑝 đģ0 đ‘Ļ ≥ đ›ŧ then accept H0
23
Model comparison
• Principle of parsimony: «plurality should not be assumed without necessity»
• Automatically enforced by Bayesian model comparison
y = f(x)
Model evidence:
𝑝 đ‘Ļ𝑚 =
𝑝 đ‘Ļ 𝜗, 𝑚 𝑝 𝜗 𝑚 d𝜗
≈ 𝑎𝑐𝑐đ‘ĸ𝑟𝑎𝑐đ‘Ļ − 𝑐𝑜𝑚𝑝𝑙𝑒đ‘Ĩ𝑖𝑡đ‘Ļ
“Occam’s razor” :
y=f(x)
model evidence p(y|m)
x
May 14, 2013
space of all data sets
24
Frequentist (or: orthodox, classical) versus
Bayesian inference: model comparison
• Define the null and the alternative hypothesis in terms of priors, e.g.:
p ī€¨Y H 0 ī€Š
īƒŦ1 if īą ī€Ŋ 0
H 0 : p ī€¨īą H 0 ī€Š ī€Ŋ īƒ­
īƒŽ0 otherwise
p ī€¨Y H1 ī€Š
H1 : p ī€¨īą H1 ī€Š ī€Ŋ N ī€¨ 0, ī“ ī€Š
y
• Apply decision rule, i.e.:
May 14, 2013
if
P ī€¨ H0 yī€Š
P ī€¨ H1 y ī€Š
Y
space of all datasets
ī‚Ŗ 1 then reject H0
25
Applications of Bayesian inference
May 14, 2013
26
segmentation
and normalisation
realignment
posterior probability
maps (PPMs)
smoothing
dynamic causal
modelling
general linear model
statistical
inference
normalisation
multivariate
decoding
Gaussian
field theory
p <0.05
template
May 14, 2013
27
Segmentation (mixture of Gaussians-model)
class variances
īŗ2
īŗ1
ī­1
…
īŗk
ī­2
yi
…
ith voxel
label
ith voxel
value
ci
īŦ
class
frequencies
ī­k
class
means
May 14, 2013
grey matter
white matter
CSF 28
fMRI time series analysis
PPM: regions best explained
by short-term memory model
short-term memory
design matrix (X)
prior variance
of GLM coeff
prior variance
of data noise
AR coeff
(correlated noise)
PPM: regions best explained
by long-term memory model
long-term memory
design matrix (X)
GLM coeff
fMRI time series
May 14, 2013
29
Dynamic causal modeling (DCM)
m1
m2
m3
m4
attention
attention
attention
attention
PPC
stim
V1
V5
PPC
stim
V1
V5
PPC
stim
V1
V5
PPC
stim
V1
V5
attention
models marginal likelihood
ln p ī€¨y mī€Š
15
PPC
10
1.25
stim
5
estimated
effective synaptic strengths
for best model (m4)
0.10
0.26
V1
0.39
0.26
0.13
V5
0.46
0
m1 m2 m3 m4
May 14, 2013
30
Model comparison for group studies
differences in log- model evidences
ln p ī€¨ y m1 ī€Š ī€­ ln p ī€¨ y m2 ī€Š
m1
m2
subjects
Fixed effect
Assume all subjects correspond to the same model
Random effect
Assume different subjects might correspond to different models
May 14, 2013
31
Thanks
May 14, 2013
32
Download