Fitting parameters of stochastic models
The particle filter gives us an estimate of the marginal likelihood for one value of \(\theta\):
\[\hat{p}(y \mid \theta) \approx \frac{1}{J}\sum_{j=1}^{J} p(y \mid x_j, \theta)\]
But we do not want the likelihood at one \(\theta\). We want the posterior over \(\theta\).
We already have an algorithm that explores a posterior using nothing but likelihood evaluations: Metropolis-Hastings.
So: propose \(\theta^*\), run a particle filter to get \(\hat{p}(y \mid \theta^*)\), and accept or reject as usual.
\[r = \min\left(1, \frac{\hat{p}(y \mid \theta^*)\, p(\theta^*)}{\hat{p}(y \mid \theta)\, p(\theta)}\right)\]
This is particle marginal Metropolis-Hastings (PMMH).
We are plugging a noisy, random likelihood estimate into an algorithm derived assuming the exact likelihood.
Run the filter twice at the same \(\theta\) and you get two different numbers. It looks like this should break the chain.
It does not. The chain still targets the correct posterior — exactly, not approximately.
The particle filter estimate is unbiased:
\[\mathbb{E}\big[\hat{p}(y \mid \theta)\big] = p(y \mid \theta)\]
Treat the random numbers used inside the filter as auxiliary variables and run Metropolis-Hastings on the enlarged space of \((\theta, \text{particles})\).
That extended chain has the right invariant distribution, and \(\theta\) marginally has the posterior we wanted.
The noise costs us efficiency, never correctness.
Andrieu et al. (2010)
When the filter happens to return an unusually high estimate, that value sits in the denominator of every subsequent acceptance ratio.
The chain then rejects good proposals for a long stretch, because it is comparing them against a lucky number rather than the truth.
The result is the flat plateaus you will see in the trace plots — much worse mixing than any chain we have run so far.
There is a genuine trade-off:
We cannot use gradients: the particle filter involves resampling and discrete event simulation, so the likelihood is not differentiable.
That rules out NUTS and leaves us with random-walk methods, which is exactly the fallback flagged in the MCMC session.
We use robust adaptive Metropolis, so at least the proposal covariance is learned rather than hand-tuned (Vihola 2012).
The pre-computed chain in the practical used 500,000 samples, 50,000 burn-in, thinned by 50, and took hours. This is normal for PMCMC, and it is the price of fitting a genuinely stochastic model.
Everything from the deterministic part of the course now carries over to stochastic models:
And we get the latent trajectories for free: each accepted \(\theta\) comes with a sampled state path, which is state estimation alongside parameter estimation.
Is temporary immunity better described by one compartment or four?
That is not a question about parameters. No amount of sampling SEITL tells you whether SEIT4L would have done better — you have to fit both.
Ways to compare:
In the practical you fit both and compare. Expect them to agree on the first wave and differ on the timing of the second.
In the practical you will
Particle MCMC