Nested Particle Filter for Stochastic SEIR Models with Latent OU Transmission
An R package implementing the online Bayesian epidemic inference framework of Feng and Wang (2025).
# From source (local):
# R CMD build npfseir
# R CMD INSTALL npfseir_0.2.1.tar.gzlibrary(npfseir)
# Fixed model parameters
fixed <- list(eps=1/5, gamma=1/7, delta=1/(70*365), b=1/(70*365),
q=0.15, N=330e6, sigma_comp=5000)
# Simulate
set.seed(1)
x0 <- c(330e6 - 5000, 2000, 3000, 0, log(0.3))
traj <- seir_simulate(400, kappa=0.10, sigma_psi=0.30,
mu_psi=log(0.25), x0=x0, fixed=fixed)
# Fit
fit <- npf_seir(traj$obs[-1], fixed, K=100, M=200, seed=42)
# Summarise and plot
summary(fit, burn=30)
plot(fit, burn=30)
# Forecast 14 days ahead
fc <- predict(fit, horizon=14)| Function | Description |
|---|---|
npf_seir() |
Run the nested particle filter |
seir_simulate() |
Simulate a stochastic SEIR trajectory |
cori_rt() |
Cori-style renewal R_t estimator (illustrative) |
ou_params() |
Exact OU discrete-time transition parameters |
Feng, W. and Wang, W. (2025). Bayesian sequential inference for a stochastic SEIR model with latent transmission dynamics. Preprint.
Crisan, D. and Miguez, J. (2018). Nested particle filters for online parameter estimation in discrete-time state-space Markov models. Bernoulli, 24(4B):3039–3086.