Particle filtering

16
Particle Filtering (Sequential Monte Carlo) and State-Space Processes Wei Wang Dec 13, 2010

Transcript of Particle filtering

Page 1: Particle filtering

Particle Filtering (Sequential Monte Carlo) andState-Space Processes

Wei Wang

Dec 13, 2010

Page 2: Particle filtering

OutlineI Motivation of Particle Filters

I Two commonly used Particle Filters

I A Stochastic Volatility Model example

Page 3: Particle filtering

State-Space ProcessesI A general state-space model is defined as

Observation equation: yt+1 ∼ p(yt+1|xt+1, θ)

Evolution equation: xt+1 ∼ p(xt+1|xt, θ)

with initial state distribution p(x0|θ) and prior p(θ).

I Some notation notes:1. xt,yt denote a single observation or state at time t.2. xt,yt denote vectors of observations or states up to time t.3. T is the total number of observations and N is the Monte Carlo

sample size in our SMC algorithm.

Page 4: Particle filtering

Inferential GoalsI There are primarily four inferential goals, namely:

1. Filtering: the posterior distribution of current latent state ateach time point and known parameters

p(xt|yt, θ) for t = 1, . . . , T

2. Learning: the posterior distribution of parameter given allobservations

p(θ|yT )

3. Smoothing: the posterior distribution of latent states given allthe observations

p(xT |yT )

4. Model Assessment: the marginal distribution of observations,used for computing Bayes Factor

p(yT )

Page 5: Particle filtering

Inferential GoalsI Due to time constraints, we will only talk about filtering today.

The dependence on parameters is depressed.1. Filtering: the posterior distribution of current latent state at

each time point and known parameters

p(xt|yt) for t = 1, . . . , T

2. Learning: the posterior distribution of parameter given allobservations

p(θ|yT )

3. Smoothing: the posterior distribution of latent states given allthe observations

p(xT |yT )

4. Model Assessment: the marginal distribution of observations,used for computing Bayes Factor

p(yT )

Page 6: Particle filtering

Kalman FiltersI When the state-space model is linear and Gaussian, it is

known as Normal Dynamic Linear Model (NDLM).

yt = F ′txt + vt

xt = Gtxt−1 +wt

vt ∼ N(0,σ2t)

wt ∼ N(0, τ2t)

in which noises vt and wt are temporally and mutually.

I The celebrated Kalman Filters solve this model using KalmanRecursions.

Page 7: Particle filtering

But the real world is not NDLMI Most real world applications are not inside the realm of NDLM.

yt|xt ∼ p(yt|xt),

xt|xt−1 ∼ p(xt|xt−1)

I We cannot get the analytical form of the recursions as we canin NDLM.

p(xt|yt−1) =

∫p(xt|xt−1)p(xt−1|y

t−1) dxt−1

p(xt|yt) ∝ p(yt|xt)p(xt|yt−1)

I But the form of the above display suggests that some kind ofMonte Carlo methods might work.

Page 8: Particle filtering

First Particle Filter: Bootstrap FilterI Gordon, Salmond and Smith (1993) proposed one of the

earliest (and still popular) particle filter: bootstrap filter.

p(xt|yt−1) =

∫p(xt|xt−1)p(xt−1|y

t−1) dxt−1 (1)

p(xt|yt) ∝ p(yt|xt)p(xt|yt−1) (2)

I The rough idea is when we have Monte Carlo samples(particles) from p(xt−1|y

t−1), we can generate new particlesfrom p(xt|y

t−1) based on (1), and then resample from newparticles based on likelihood ratio to get the particles fromp(xt|y

t).

Page 9: Particle filtering

Bootstrap Filter

1. Propagate {x(i)t−1}

Ni=1 to {x̃

(i)t }Ni=1 via p(xt|xt−1)

2. Resample {x(i)t }Ni=1 from {x̃

(i)t−1}

Ni=1 with weights

wit ∝ p(yt|x̃

(i)t )

Algorithm 1: Bootstrap Filter

I Bootstrap Filter belongs to the class of Propagate-ResampleFilters.

I Bootstrap Filter is incredibly easy to implement, since we onlyneed to be able to sample from evolutionary densityp(xt|xt−1) and to compute likelihood p(yt|xt).

I Notice that the Resampling step is not essential.

Page 10: Particle filtering

Drawback of Bootstrap FilterI However, Bootstrap Filter suffers from severe Model

Degeneracy (Model Impoverishment).

I In the Propagation step, information of new observation yt isnot incorporated, so the propagated states may not beimportant or high likelihood states, and so at the resamplingstep most weights are given to a few of the new states. Thenwe won’t have a good Monte Carlo sample of the objectivedistribution.

I Of course, if we set the MC sample size N large enough, wemight reduce the Model Degeneracy to a reasonable range,but it is too computationally expensive.

Page 11: Particle filtering

Another Approach: Auxiliary Particle FilterI The problem with Bootstrap Filter is the blind propagation.

I Playing with math, we can find the following thing

p(xt|yt) ∝ p(xt|xt−1,yt)p(yt|xt−1)p(xt−1|y

t−1)

I Based on this Pitt and Shephard (1999) proposed aResample-Propagate scheme.

I The idea is with MC samples from p(xt−1|yt−1), we resample

to get p(xt−1|yt), then propagate to get MC samples from

p(xt|yt).

Page 12: Particle filtering

Auxiliary Particle Filter

1. Resample {x̃(i)t−1}

Ni=1 from {x

(i)t−1}

Ni=1 with weights

wit ∝ p(yt|x

(i)t−1)

2. Propagate {x̃(i)t−1}

Ni=1 to {x

(i)t }Ni=1 via p(xt|xt−1,yt)

Algorithm 2: Auxiliary Particle Filter

I In APF, we use current observation yt in our first resamplingstep, so only “good” particles are propagated forward. Itshould be more efficient than Boostrap Filter.

Page 13: Particle filtering

Drawback of APFI But nothing comes for free. In order to use the Algorithm

given above, we need to (1) be able to compute the predictivelikelihood p(yt|xt−1) and (2) be able to sample from“evolution-posterior” density p(xt|xt−1,yt).

I These are often impossible in most cases.

I An general approach is Importance Sampling. Pitts andShephard (1999) suggests:

1. Use p(yt|g(xt−1)), i.e. likelihood p(yt|xt) evaluated atg(xt−1) as proposal weights of resample;

2. Use evolution kernel p(xt|xt−1) as the proposal density topropagate particles.

Page 14: Particle filtering

An Applicable APF

1. Resample {x̃(i)t−1}

Ni=1 from {x

(i)t−1}

Ni=1 with weights

wit ∝ p(yt|g(x

(i)t−1))

2. Propagate {x̃(i)t−1}

Ni=1 to {x̃

(i)t }Ni=1 via p(xt|xt−1)

3. Resample {x(i)t }Ni=1 from {x̃

(i)t }Ni=1 with weights

wit ∝

p(yt|x̃(i)t )

p(yt|g(x̃(i)t−1))

Algorithm 3: An Applicable Auxiliary Particle Filter

I The performance of APF depends hugely on how we chooseproposal density. In some cases, it might perform worse thanBootsrap Filter.

Page 15: Particle filtering

Example: Stochastic Volatility ModelI Consider a very simple log-stochastic volatility model

yt =√Vtεt

log(Vt) = α+ β log(Vt−1) + σηt

log(V1) ∼ N(0,σ20)

α = 0,β = .95,σ = σ0 = .1, T = 500

Time

y

−2

0

2

4

100 200 300 400 500

Page 16: Particle filtering

Example: Stochastic Volatility Model

Volatility BF

Time

0.5

1.0

1.5

2.0

2.5

3.0

3.5

●●●●●

●●●●

●●

●●●●●●●●●●●●●●

●●●●●

●●

●●●●●●●

●●

●●●●

●●●●●●●●●●

●●●

●●●●

●●●●●

●●●●

●●●●

●●●●●●●●●●

●●●●●●●

●●●●●●

●●●●

●●●●●

●●●●●

●●●

●●●

●●●

●●●●●●●●●

●●●●●●●●

●●●●●●

●●●●●

●●●●●●●●●

●●●●●

●●●●●●●●●●●●

●●●

●●●●

●●●●●

●●

●●

●●

●●

●●●

●●●●●

●●

●●●●●

●●●●●●●●●●●●●●●●●●●

●●●●●●●●●

●●●●●●●●

●●●

●●

●●

●●●●●●

●●●●●●

●●

●●●●●●●

●●

●●●●●●●●●

●●●

●●

●●●●●●●

●●●●

●●●●●●●●

●●●●●●●●

●●●●●●●

●●●

●●●●●●●

●●●●

●●●●●●●●●

●●

●●●

●●

●●

●●●●

●●●●●

●●●●●

●●●

●●

●●

●●●●●

●●●

●●●●●●●●●

●●●●●

●●●●●●●

●●●●

●●●●●●●●●

●●●●

●●●●●

●●●●●

●●●●●●

●●●●●●●●●

●●●●●●●●●●

●●●●●●●

●●●●●●●●●

●●●●●●

●●●●

●●●●●

●●●●

●●

●●●●●●●●●●●●●●

●●●●●

●●

●●●●●●●

●●

●●●●

●●●●●●●●●●

●●●

●●●●

●●●●●

●●●●

●●●●

●●●●●●●●●●

●●●●●●●

●●●●●●

●●●●

●●●●●

●●●●●

●●●

●●●

●●●

●●●●●●●●●

●●●●●●●●

●●●●●●

●●●●●

●●●●●●●●●

●●●●●

●●●●●●●●●●●●

●●●

●●●●

●●●●●

●●

●●

●●

●●

●●●

●●●●●

●●

●●●●●

●●●●●●●●●●●●●●●●●●●

●●●●●●●●●

●●●●●●●●

●●●

●●

●●

●●●●●●

●●●●●●

●●

●●●●●●●

●●

●●●●●●●●●

●●●

●●

●●●●●●●

●●●●

●●●●●●●●

●●●●●●●●

●●●●●●●

●●●

●●●●●●●

●●●●

●●●●●●●●●

●●

●●●

●●

●●

●●●●

●●●●●

●●●●●

●●●

●●

●●

●●●●●

●●●

●●●●●●●●●

●●●●●

●●●●●●●

●●●●

●●●●●●●●●

●●●●

●●●●●

●●●●●

●●●●●●

●●●●●●●●●

●●●●●●●●●●

●●●●●●●

●●●●●●●●●

●●●●●●

●●●●

100 200 300 400 500

Volatility APF

Time

0.5

1.0

1.5

2.0

2.5

3.0

3.5

●●●●●

●●●●

●●

●●●●●●●●●●●●●●

●●●●●

●●

●●●●●●●

●●

●●●●

●●●●●●●●●●

●●●

●●●●

●●●●●

●●●●

●●●●

●●●●●●●●●●

●●●●●●●

●●●●●●

●●●●

●●●●●

●●●●●

●●●

●●●

●●●

●●●●●●●●●

●●●●●●●●

●●●●●●

●●●●●

●●●●●●●●●

●●●●●

●●●●●●●●●●●●

●●●

●●●●

●●●●●

●●

●●

●●

●●

●●●

●●●●●

●●

●●●●●

●●●●●●●●●●●●●●●●●●●

●●●●●●●●●

●●●●●●●●

●●●

●●

●●

●●●●●●

●●●●●●

●●

●●●●●●●

●●

●●●●●●●●●

●●●

●●

●●●●●●●

●●●●

●●●●●●●●

●●●●●●●●

●●●●●●●

●●●

●●●●●●●

●●●●

●●●●●●●●●

●●

●●●

●●

●●

●●●●

●●●●●

●●●●●

●●●

●●

●●

●●●●●

●●●

●●●●●●●●●

●●●●●

●●●●●●●

●●●●

●●●●●●●●●

●●●●

●●●●●

●●●●●

●●●●●●

●●●●●●●●●

●●●●●●●●●●

●●●●●●●

●●●●●●●●●

●●●●●●

●●●●

●●●●●

●●●●

●●

●●●●●●●●●●●●●●

●●●●●

●●

●●●●●●●

●●

●●●●

●●●●●●●●●●

●●●

●●●●

●●●●●

●●●●

●●●●

●●●●●●●●●●

●●●●●●●

●●●●●●

●●●●

●●●●●

●●●●●

●●●

●●●

●●●

●●●●●●●●●

●●●●●●●●

●●●●●●

●●●●●

●●●●●●●●●

●●●●●

●●●●●●●●●●●●

●●●

●●●●

●●●●●

●●

●●

●●

●●

●●●

●●●●●

●●

●●●●●

●●●●●●●●●●●●●●●●●●●

●●●●●●●●●

●●●●●●●●

●●●

●●

●●

●●●●●●

●●●●●●

●●

●●●●●●●

●●

●●●●●●●●●

●●●

●●

●●●●●●●

●●●●

●●●●●●●●

●●●●●●●●

●●●●●●●

●●●

●●●●●●●

●●●●

●●●●●●●●●

●●

●●●

●●

●●

●●●●

●●●●●

●●●●●

●●●

●●

●●

●●●●●

●●●

●●●●●●●●●

●●●●●

●●●●●●●

●●●●

●●●●●●●●●

●●●●

●●●●●

●●●●●

●●●●●●

●●●●●●●●●

●●●●●●●●●●

●●●●●●●

●●●●●●●●●

●●●●●●

●●●●

100 200 300 400 500