SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential...

50
SMC 2 : an efficient algorithm for sequential analysis of state-space models N. CHOPIN 1 , P.E. JACOB 2 , & O. PAPASPILIOPOULOS 3 1 ENSAE-CREST 2 CREST & Universit´ e Paris Dauphine, 3 Universitat Pompeu Fabra & Ram´ on y Cajal N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC 2 1/ 48

Transcript of SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential...

Page 1: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

SMC2: an efficient algorithm for sequentialanalysis of state-space models

N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

1ENSAE-CREST2CREST & Universite Paris Dauphine,3Universitat Pompeu Fabra & Ramon y Cajal

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 1/ 48

Page 2: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Statement of the problem

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 2/ 48

Page 3: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

State Space Models

A system of equations

Hidden states (Markov): p(x1|θ) = µθ(x1) and for t ≥ 1

p(xt+1|x1:t , θ) = p(xt+1|xt , θ) = fθ(xt+1|xt)

Observations:

p(yt |y1:t−1, x1:t−1, θ) = p(yt |xt , θ) = gθ(yt |xt)

Parameter: θ ∈ Θ, prior p(θ).

We observe y1:T = (y1, . . . yT ), T might be large (≈ 104). x and θalso of several dimensions. Many models where fθ or gθ cannot bewritten in closed form

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 3/ 48

Page 4: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

State Space Models

Some interesting distributions

Bayesian inference focuses on:

static: p(θ|y1:T ) dynamic: p(θ|y1:t) , t ∈ 1 : T

Filtering (traditionally) focuses on:

∀t ∈ [1,T ] pθ(xt |y1:t)

Smoothing (traditionally) focuses on:

∀t ∈ [1,T ] pθ(xt |y1:T )

Prediction:

p(yt+1 | y1:t) =

∫gθ(yt+1 | xt+1)fθ(xt+1 | xt)

× pθ(xt | y1:t)p(θ | y1:t)dxtdθ

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 4/ 48

Page 5: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

An example

Stochastic Volatility (Levy-driven models)

Observations (“log returns”):

yt = µ+ βvt + v1/2t εt , t ≥ 1

Hidden states (“actual volatility” - integrated process):

vt+1 =1

λ(zt − zt+1 +

k∑j=1

ej)

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 5/ 48

Page 6: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

An example

. . . where the process zt is the “spot volatility”:

zt+1 = e−λzt +k∑

j=1

e−λ(t+1−cj )ej

k ∼ Poi(λξ2/ω2

)c1:k

iid∼ U(t, t + 1) ei :kiid∼ Exp

(ξ/ω2

)The parameter is θ ∈ (µ, β, ξ, ω2, λ), and xt = (vt , zt)

′.

See the results

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 6/ 48

Page 7: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Why are those models challenging?

. . . It is effectively impossible to compute the likelihood

p(y1:T |θ) =

[∫XT

p(y1:T |x1:T , θ)p(x1:T |θ)dx1:T

]

Similarly, all other inferential quantities are impossible to compute.

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 7/ 48

Page 8: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Problems with MCMC and IS approaches

We cannot compute the likelihood or sample from p(θ|y1:T )directly

Importance Sampling (IS) results in polynomial or exponentialin t increase of variance; e.g. Section 4 in Kong, Liu, Wong(1994, JASA); Bengtsson, T., Bickel, P., and Li, B. (2008);Theorem 4 of Chopin (2004; AoS)

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 8/ 48

Page 9: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

An MCMC approach would be to sample the parameters andstates jointly. But:

The high-dimensional autocorrelated state process is difficultto simulate efficiently conditionally on the observations

High dependence between parameters and state variablescause poor performance of Gibbs sampler

Furthermore, MCMC methods are not designed to recover thewhole sequence π(x1:t , θ | y1:t) computationally efficiently,instead they sample from the “static” distributionπ(x1:T , θ | y1:T )

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 9/ 48

Page 10: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Methodology Pt I

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 10/ 48

Page 11: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Monte Carlo in Bayesian statistics: the new generation

This problem is an instance of situation frequently encountered inmodern applications: statistical inference with intractable densities,which however can be estimated using Monte Carlo.

This is harder version of the main problem in Bayesian statistics(intractable integrals) which traditionally has been addressed bydata augmentation, simulated likelihood, EM, etc.

A new generation of methods has emerged, a common feature ofwhich is the interplay between unbiased estimation and auxiliaryvariables with aim at constructing exact MC

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 11/ 48

Page 12: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Some characteristic references in that respect include:

ABC methods, e.g Pritchard et. al (1999), Molec. Biol. Evol

MCMC for models with intractable normalizing constants, e.gMøller et. al (2006), Biometrika

Pseudo-marginal MCMC, Andrieu and Roberts (2009), Ann.Stat.

Random weight particle filters, e.g Fearnhead et. al (2010), J.Roy. Stat. Soc. B

Particle MCMC methods, e.g Andrieu, Doucet and Holenstein(2010), J. Roy. Stat. Soc. B

Our approach fits in this framework, allowing fully Bayesiansequential inference (whereas aforementioned approaches deal with“static” MCMC or inference for dynamic models with fixedparameters)

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 12/ 48

Page 13: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Main tools of our approach

Particle filter algorithms for state-space models

Iterated Batch Importance Sampling for sequential Bayesianinference for parameters

Both are sequential Monte Carlo (SMC) methods

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 13/ 48

Page 14: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

1. Particle filters

Consider the simplified problem of targeting

pθ(xt+1|y1:t+1)

for a given value of θ.

This sequence of distributions is approximated by a sequence ofweighted particles which are properly weighted using importancesampling, mutated/propagated according to the system dynamics,and resampled to control the variance.

Below we give a pseudo-code version. Any operation involving thesuperscript n must be understood as performed for n = 1 : Nx ,where Nx is the total number of particles.

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 14/ 48

Page 15: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Step 1: At iteration t = 1,

(a) Sample xn1 ∼ q1,θ(·).

(b) Compute and normalise weights

w1,θ(xn1 ) =µθ(xn1 )gθ(y1|xn1 )

q1,θ(xn1 ), W n

1,θ =w1,θ(xn1 )∑Ni=1 w1,θ(x i1)

.

Step 2: At iteration t = 2 : T

(a) Sample the index ant−1 ∼M(W 1:Nxt−1,θ) of the ancestor

(b) Sample xnt ∼ qt,θ(·|xant−1

t−1 ).

(c) Compute and normalise weights

wt,θ(xant−1

t−1 , xnt ) =

fθ(xnt |xant−1

t−1 )gθ(yt |xnt )

qt,θ(xnt |xant−1

t−1 ), W n

t,θ =wt,θ(x

ant−1

t−1 , xnt )∑Nx

i=1 wt,θ(xait−1

t−1 , xit)

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 15/ 48

Page 16: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Observations

At each t, (w(i)t , x

(i)1:t)Nx

i=1 is a particle approximation ofpθ(xt |y1:t).

Resampling to avoid degeneracy.

In principle (w(i)t , x

(i)1:t)Nx

i=1 is also a particle approximation ofpθ(x1:t |y1:t) (bad notation! careful with genealogy)

Resampling makes this a very poor approximation for large t,known as the path degeneracy problem

Taking qθ = fθ simplifies weights, but mainly yields a feasiblealgorithm when fθ can only be simulated

Notation: ψt,θ the distribution that all variables are drawnfrom upto time t (particles and ancestors)

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 16/ 48

Page 17: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Unbiased likelihood estimator

A by-product of PF output is that

ZNt =

T∏t=1

(1

Nx

Nx∑i=1

w(i)t

)

is an unbiased estimator of the likelihood Zt = p(y1:t |θ) for all t.

Whereas consistency of the estimator is immediate to check,unbiasedness is subtle, see e.g Proposition 7.4.1 in Del Moral. Thevariance of this estimator grows typically linealy with T (and notexponentially) because of dependence of the factors in theproduct.

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 17/ 48

Page 18: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

2. IBIS

SMC method for particle approximation of the sequence p(θ | y1:t)for t = 1 : T , for models where likelihood is tractable; see e.g.Chopin (2002, Bmka) for details

Again, the sequence of parameter posterior distribution isapproximated by Nθ weighted particles,

(θm, ωm)Nθm=1

By product: consistent estimators of the predictive densities

Lt =

∫p(yt |y1:t−1, θ)p(θ)dθ

hence of the model evidence

In the next slide we give the pseudo-code of the IBIS algorithm.Operations with superscript m must be understood as operationsperformed for all m ∈ 1 : Nθ

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 18/ 48

Page 19: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Sample θm from p(θ) and set ωm ← 1. Then, at time t = 1, . . . ,T

(a) Compute the incremental weights and their weightedaverage

ut(θm) = p(yt |y1:t−1, θ

m), Lt =1∑Nθ

m=1 ωm×

Nθ∑m=1

ωmut(θm),

(b) Update the importance weights,

ωm ← ωmut(θm). (1)

(c) If some degeneracy criterion is fulfilled, sample θm

independently from the mixture distribution

1∑Nθm=1 ω

m

Nθ∑m=1

ωmKt (θm, ·) .

Finally, replace the current weighted particle system:

(θm, ωm)← (θm, 1).

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 19/ 48

Page 20: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Observations

Cost of lack of ergodicity in θ: the occasional MCMC move

Still, in regular problems resampling happens at diminishingfrequency (logarithmically)

Kt is an MCMC kernel invariant wrt π(θ | y1:t). Itsparameters can be chosen using information from currentpopulation of θ-particles

Lt can be used to obtain an estimator of the model evidence

Infeasible to implement for state-space models: intractableincremental weights, and MCMC kernel

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 20/ 48

Page 21: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Our algorithm: SMC2

We provide a generic (black box) algorithm for recovering thesequence of parameter posterior distributions, but as well filtering,smoothing and predictive.

We give next a pseudo-code; the code seems to only track theparameter posteriors, but actually it does all other jobs.Superficially, it looks an approximation of IBIS, but in fact it doesnot produce any systematic errors (unbiased MC)

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 21/ 48

Page 22: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Sample θm from p(θ) and set ωm ← 1. Then, at timet = 1, . . . ,T ,

(a) For each particle θm, perform iteration t of the PF: If

t = 1, sample independently x1:Nx ,m1 from ψ1,θm , and

compute

p(y1|θm) =1

Nx

Nx∑n=1

w1,θ(xn,m1 );

If t > 1, sample(x1:Nx ,mt , a1:Nx ,m

t−1

)from ψt,θm

conditional on(x1:Nx ,m

1:t−1 , a1:Nx ,m1:t−2

), and compute

p(yt |y1:t−1, θm) =

1

Nx

Nx∑n=1

wt,θ(xan,mt−1,m

t−1 , xn,mt ).

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 21/ 48

Page 23: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

(b) Update the importance weights,

ωm ← ωmp(yt |y1:t−1, θm)

(c) If some degeneracy criterion is fulfilled, sample(θm, x1:Nx ,m

1:t , a1:Nx1:t−1

)independently from

1∑Nθm=1 ω

m

Nθ∑m=1

ωmKt

{(θm, x1:Nx ,m

1:t , a1:Nx ,m1:t−1

), ·}

Finally, replace current weighted particle system:

(θm, x1:Nx ,m1:t , a1:Nx ,m

1:t−1 , ωm)← (θm, x1:Nx ,m1:t , a1:Nx ,m

1:t−1 , 1)

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 22/ 48

Page 24: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Observations

It appears as approximation to IBIS. For Nx =∞ it is IBIS.

However, no approximation is done whatsoever. Thisalgorithm really samples from p(θ|y1:t) and all otherdistributions of interest. One would expect an increase of MCvariance over IBIS.

The validity of algorithm is essentially based on two results: i)the particles are properly weighted due to unbiasedness ofPF estimator of likelihood; ii) the MCMC kernel isappropriately constructed to maintain invariance wrt to anexpanded distribution which admits those of interest asmarginals; it is a Particle MCMC kernel.

The algorithm does not suffer from the path degeneracyproblem due to the MCMC updates

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 22/ 48

Page 25: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Theory Pt I

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 23/ 48

Page 26: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Proposition

The probability density πt may be written as:

πt(θ, x1:Nx1:t , a1:Nx

1:t−1) = p(θ|y1:t)

× 1

Nx

Nx∑n=1

p(xn1:t |θ, y1:t)

Nt−1x

Nx∏i=1

i 6=hnt (1)

q1,θ(x i1)

×

t∏

s=2

Nx∏i=1

i 6=hnt (s)

Wais−1

s−1,θqs,θ(x is |xais−1

s−1 )

Intuition when t = 1

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 24/ 48

Page 27: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Methodology Pt II

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 25/ 48

Page 28: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Principled framework for algorithmic improvements

Elaborating on Proposition 1 we propose several formal ways forthe following algorithmic operations:

MCMC rejuvenation step within the PMCMC

Sampling from the smoothing distributions

Automatic calibration of Nx

Dealing with intractable gθ

SMC2 can be used for more general sequences of distributions,e.g. obtained by tempering

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 26/ 48

Page 29: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

The MCMC rejuvenation step

(a) Sample θ from proposal kernel, θ ∼ T (θ, d θ).

(b) Run a new PF for θ: sample independently(x1:Nx

1:t , a1:Nx1:t−1) from ψt,θ, and compute

Zt(θ, x1:Nx1:t , a1:Nx

1:t−1).

(c) Accept the move with probability

1 ∧p(θ)Zt(θ, x

1:Nx1:t , a1:Nx

1:t−1)T (θ, θ)

p(θ)Zt(θ, x1:Nx1:t , a1:Nx

1:t−1)T (θ, θ).

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 27/ 48

Page 30: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

It directly follows from the Proposition that this algorithm definesa standard Hastings-Metropolis kernel with proposal distribution

qθ(θ, x1:Nx1:t , a1:Nx

1:t ) = T (θ, θ)ψt,θ(x1:Nx1:t , a1:Nx

1:t )

and admits as invariant distribution the extended distributionπt(θ, x

1:Nx1:t , a1:Nx

1:t−1).

This is precisely a particle MCMC step, as in Andrieu et al. (2010,JRSSB).

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 28/ 48

Page 31: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Dynamic increase of Nx

Why increasing Nx is necessary?

Our framework allows the dynamic and automatic increase of Nx

using the generalized importance sampling strategy of Del Moral etal. (2006).

We propose two approaches; a particle exchange and a conditionalSMC, the latter being more efficient (in terms of minimizingvariance of weights) but memory intensive

They get triggered when a degeneracy criterion is fulfilled

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 29/ 48

Page 32: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Particle exchange

Exchange importance sampling step

Launch a new SMC for each θ-particle, with Nx x-particles. Jointdistribution:

πt(θ, x1:Nx1:t , a1:Nx

1:t−1)ψt,θ(x1:Nx1:t , a1:Nx

1:t−1)

Retain the new x-particles and drop the old ones, updating theθ-weights with:

uexcht

(θ, x1:Nx

1:t , a1:Nx1:t−1, x

1:Nx1:t , a1:Nx

1:t−1

)=

Zt(θ, x1:Nx1:t , a1:Nx

1:t−1)

Zt(θ, x1:Nx1:t , a1:Nx

1:t−1)

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 30/ 48

Page 33: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Numerics

Extensive study of numerical performance and comparisons, bothin the paper and its Supplement, both available at ArXiv.

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 31/ 48

Page 34: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Numerical illustrations: SV

Time

Squ

ared

obs

erva

tions

0

2

4

6

8

200 400 600 800 1000

(a)

Iterations

Acc

epta

nce

rate

s0.0

0.2

0.4

0.6

0.8

1.0

0 200 400 600 800 1000

(b)

Iterations

Nx

100

200

300

400

500

600

700

800

0 200 400 600 800 1000

(c)

Figure: Squared observations (synthetic data set), acceptance rates, andillustration of the automatic increase of Nx .

See the model

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 32/ 48

Page 35: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Numerical illustrations: SV

µ

dens

ity

0

1

2

3

4

5

6

7

250

−0.5 0.0 0.5 1.0

500

−0.5 0.0 0.5 1.0

1000

−0.5 0.0 0.5 1.0

Run

1

2

3

4

5

β

dens

ity

0.0

0.5

1.0

1.5

2.0

2.5

3.0

250

−1.5 −1.0 −0.5 0.0 0.5 1.0

500

−1.5 −1.0 −0.5 0.0 0.5 1.0

1000

−1.5 −1.0 −0.5 0.0 0.5 1.0

Run

1

2

3

4

5

ξ

dens

ity

0

1

2

3

4

5250

1 2 3 4 5 6

500

1 2 3 4 5 6

1000

1 2 3 4 5 6

Run

1

2

3

4

5

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 33/ 48

Page 36: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Numerical illustrations: SV

Time

Comp

uting t

ime (s

)5000

10000

15000

20000

25000

L&W

200 400 600 800 1000

SMC2

200 400 600 800 1000

Run

1

2

3

4

5

(a)

ξ

dens

ity

0.0

0.5

1.0

1.5

2.0

2.5

3.0

3.5

L&W

2 4 6 8

SMC2

2 4 6 8

PMCMC

2 4 6 8

Run

1

2

3

4

5

(b)

Time

log

evid

ence

min

us re

fere

nce

−2

−1

0

1

2

L&W

200 400 600 800

SMC2

200 400 600 800

Run

1

2

3

4

5

(c)N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 34/ 48

Page 37: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Numerical illustrations: SV

Time

Squ

ared

obs

erva

tions

5

10

15

20

100 200 300 400 500 600 700

(d)

IterationsE

vide

nce

com

pare

d to

the

one

fact

or m

odel

−2

0

2

4

100 200 300 400 500 600 700

variableMulti factor without leverageMulti factor with leverage

(e)

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 35/ 48

Page 38: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Theory Pt II

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 36/ 48

Page 39: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Stability of the algorithm and computational complexity

The algorithm refreshes at each MCMC step, but at the expense ofre-visiting all available data so far. The computational complexityof the algorithm is determined by the frequency at which needs toresort to this step.

If after each resampling the particles are simulated from πt , thenfor a time t + p such that no resampling has happened since t, theinverse of the second moment of the normalized weights in SMC2

and IBIS is given by

ENxt,t+p =

{Eπt,t+p

[Zt+p|t(θ, x

1:Nx1:t+p, a

1:Nx1:t+p−1)2

p(yt+1:t+p|y1:t)2

]}−1

E∞t,t+p =

{Ep(θ|y1:t)

[p(θ|y1:t+p)2

p(θ|y1:t)2

]}−1

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 37/ 48

Page 40: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Proposition

1 Under Assumptions (H1a) and (H1b) in Appendix there existsa constant η > 0 such that for any p, if Nx > ηp,

ENxt,t+p ≥

1

2E∞t,t+p. (2)

2 Under Assumptions (H2a)-(H2d) in Appendix for any γ > 0there exist τ, η > 0 and t0 <∞, such that for t ≥ t0,

ENxt,t+p ≥ γ, for p = dτ te , Nx = dηte .

This suggests that the computational cost of the algorithm up totime t is O(Nθt

2) which should be contrasted with the O(Nθt)cost of IBIS under the Assumptions (H2a)-(H2d).

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 38/ 48

Page 41: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Final Remarks

A powerful framework

The article is available on arXiv and our web pages

A package is available:

http://code.google.com/p/py-smc2/.

Parallel computing implementation using GPUs by Fulop andLi (2011)

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 39/ 48

Page 42: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Appendix

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 40/ 48

Page 43: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Some challenges for short-term future

Theoretical: justify the orange claim

Numerical: combined with GPU implementation, try thealgorithm on extremely hard problems

Algorithmic: find a better diagnostic for increase Nx

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 41/ 48

Page 44: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Why does it work? - Intuition for t = 1

At time t = 1, the algorithm generates variables θm from the priorp(θ), and for each θm, the algorithm generates vectors x1:Nx ,m

1 ofparticles, from ψ1,θm(x1:Nx

1 ).

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 42/ 48

Page 45: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Thus, the sampling space is Θ×XNx , and the actual “particles” ofthe algorithm are Nθ independent and identically distributed copiesof the random variable (θ, x1:Nx

1 ), with density:

p(θ)ψ1,θ(x1:Nx1 ) = p(θ)

Nx∏n=1

q1,θ(xn1 ).

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 43/ 48

Page 46: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Then, these particles are assigned importance weightscorresponding to the incremental weight functionZ1(θ, x1:Nx

1 ) = N−1x

∑Nxn=1 w1,θ(xn1 ).

This means that, at iteration 1, the target distribution of thealgorithm should be defined as:

π1(θ, x1:Nx1 ) = p(θ)ψ1,θ(x1:Nx

1 )×Z1(θ, x1:Nx

1 )

p(y1),

where the normalising constant p(y1) is easily deduced from theproperty that Z1(θ, x1:Nx

1 ) is an unbiased estimator of p(y1|θ).

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 44/ 48

Page 47: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Direct substitutions yield

π1(θ, x1:Nx1 ) =

p(θ)

p(y1)

Nx∏i=1

q1,θ(x i1)

{1

Nx

Nx∑n=1

µθ(xn1 )gθ(y1|xn1 )

q1,θ(xn1 )

}

=1

Nx

Nx∑n=1

p(θ)

p(y1)µθ(xn1 )gθ(y1|xn1 )

Nx∏

i=1,i 6=n

q1,θ(x i1)

and noting that, for the triplet (θ, x1, y1) of random variables,

p(θ)µθ(x1)gθ(y1|x1) = p(θ, x1, y1) = p(y1)p(θ|y1)p(x1|y1, θ)

one finally gets that:

π1(θ, x1:Nx1 ) =

p(θ|y1)

Nx

Nx∑n=1

p(xn1 |y1, θ)

Nx∏

i=1,i 6=n

q1,θ(x i1)

.

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 45/ 48

Page 48: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

By a simple induction, one sees that the target density πt atiteration t ≥ 2 should be defined as:

πt(θ, x1:Nx1:t , a1:Nx

1:t−1) = p(θ)ψt,θ(x1:Nx1:t , a1:Nx

1:t−1)×Zt(θ, x

1:Nx1:t , a1:Nx

1:t−1)

p(y1:t)

and similarly we obtain Proposition 1

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 46/ 48

Page 49: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

Assumptions

(H1a) For all θ ∈ Θ, and x , x ′, x ′′ ∈ X ,

fθ(x |x ′)fθ(x |x ′′)

≤ β.

(H1b) For all θ ∈ Θ, x , x ′ ∈ X , y ∈ Y,

gθ(y |x)

gθ(y |x ′)≤ δ.

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 47/ 48

Page 50: SMC2: an efficient algorithm for sequential analysis …...SMC2: an e cient algorithm for sequential analysis of state-space models N. CHOPIN1, P.E. JACOB2, & O. PAPASPILIOPOULOS3

(H2a) The MLE θt (the mode of function lt(θ)) exists and convergesto θ0 as n→ +∞.

(H2b) The observed information matrix defined as

Σt = −1

t

∂lt(θt)

∂θ∂θ′

is positive definite and converges to I (θ0), the Fisherinformation matrix.

(H2c) There exists ∆ such that, for δ ∈ (0,∆),

lim supt→+∞

1

tsup

‖θ−θt‖>δ

{lt(θ)− lt(θt)

} < 0.

(H2d) The function lt/t is six-times continuously differentiable, andits derivatives of order six are bounded relative to t over anycompact set Θ′ ⊂ Θ.

N. CHOPIN, P.E. JACOB, & O. PAPASPILIOPOULOS SMC2 48/ 48