Brook Milligan
unread,Aug 4, 2026, 11:33:57 AMAug 4Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to nimble-users
I’m trying to learn nimble particle filters for a time series and running into a problem. In this little example, the top level parameters are the initial condition, n0, the growth rate, lambda, and the standard deviation, sigma; latent variables are x[i], and data are y[i]. Based upon the nimbleSMC paper, my model is
MCMC_code <- nimbleCode({
n0 ~ dnorm(10,50)
lambda ~ dunif(0.9,1.1)
sigma ~ dunif(0,10)
x[1] ~ dnorm(mean=n0, sd=sigma)
for (i in 2:n) {
x[i] ~ dnorm(mean=lambda * x[i-1], sd=sigma)
}
for (i in 1:n) {
y[i] ~ dpois(lambda=x[i])
}
})
The samplers are defined with
auxpf <- buildAuxiliaryFilter(nimble_model, “x",
control = list(saveAll = FALSE, smoothing = FALSE, initModel = FALSE))
propSD <- c(0.089, 0.089, 0.039)
nimble_configured$addSampler(target = c("n0", "lambda", "sigma"),
type = "RW_PF_block", control = list(propCov = diag(propSD^2),
pf = auxpf, adaptive = TRUE, pfNparticles = MCMC_particles, latents = “x"))
The results are nonsensical (to me). In short, n0 goes straight to the minimum value and the trace plots flatline.
If I remove n0 from the likelihood altogether, and give x[1] a prior like dnorm(30,50), the model behaves much better, but still does not fit the data well.
I expect this is all me not understanding how to use the particle filters, especially to get the initial condition for a hidden Markov chain.
Any help is greatly appreciated.
Thanks a lot.
Cheers,
Brook