
Bayesian Inference on the Brain 11
Algorithm 1.2 SMC algorithm for quantifying the uncertainty in change
points.
Approximating p(θ|y
1:t
)
for i = 1, . . . , N Sample θ
i
0
∼ q
1
.
Compute for each i
W
i
1
=
w
1
(θ
i
0
)
P
N
j=1
w
1
(θ
j
0
)
where w
1
(θ
0
) =
p(θ
0
)
q
1
(θ
0
)
Resample {θ
i
0
, W
i
0
}
N
i=1
to obtain {
¯
θ
i
0
, 1/N}
N
i=1
.
for each i = 1, . . . , N: Sample θ
i
1
∼ K
1
(
¯
θ
i
0
, ·) where K
1
is a p-invariant
Markov kernel.
for n = 2, . . . , n
max
do
Reweighting:
for e ach i = 1, . . . , N compute:
ew
n
(
¯
θ
i
n−1
, θ
i
n
) =
π
n
(
¯
θ
i
n−1
)
π
n−1
(
¯
θ
i
n−1
)
=
p(y
1:t
|
¯
θ
i
n−1
)
γ
n
p(y
1:t
|
¯
θ
i
n−1
)
γ
n−1
.
and normalis e W
i
n
= ew
n
(θ
i
n−1
, θ
i
n
)
P
N
j=1
ew
n
(θ
j
n−1
, θ
j
n
).
Resample {θ
i
n−1
, W
i
n
}
N
i=1
to obtain {
¯
θ
i
n−1
, 1/N}
n
i=1
.
for each i = 1,