MyNixOS website logo
Description

Nested Particle Filter for Stochastic SEIR Epidemic Models.

Implements the online Bayesian inference framework for joint state and parameter estimation in a stochastic Susceptible-Exposed-Infectious-Recovered (SEIR) epidemic model with a time-varying transmission rate. The log-transmission rate is modelled as a latent Ornstein-Uhlenbeck (OU) process with exact Gaussian discrete-time transitions. Inference is performed via the nested particle filter (NPF) of Crisan and Miguez (2018) <doi:10.3150/17-BEJ954>, which maintains an outer particle layer over the OU hyperparameters and, for each outer particle, an inner bootstrap filter over epidemic states. The Cori-style renewal-equation estimator follows Cori et al. (2013) <doi:10.1093/aje/kwt133>. The package also provides utilities for simulation, posterior summarisation, and forecasting.

npfseir

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).

Installation

# From source (local):
# R CMD build npfseir
# R CMD INSTALL npfseir_0.2.1.tar.gz

Quick start

library(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)

Key functions

FunctionDescription
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

Citation

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.

Metadata

Version

0.2.1

License

Unknown

Platforms (80)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arc-linux
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • sh4-linux
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows