Particle filtering with sampleresamplemove algorithm for multilevel statespace model of Blocker & Airoldi (2011). This has lognormal autoregressive dynamics on OD intensities, lognormal emission distributions, and truncated normal observation densities. This can return full (all particles) output, but it is typically better to aggregate results as you go to reduce memory consumption. It can also run forward or backward filtering for smoothing. These results are combined via a separate function for smoothing; however, this procedure typically performs poorly due to differences between the distributions of particles from forward and reverse filtering.
1 2 3 4  bayesianDynamicFilter(Y, A, prior, lambda0, sigma0, phi0, rho = 0.1,
tau = 2, m = 1000, verbose = FALSE, Xdraws = 5 * m, Xburnin = m,
Movedraws = 10, nThresh = 10, aggregate = FALSE, backward = FALSE,
tStart = 1)

Y 
matrix (n x l) of observed link loads over time, one observation per row 
A 
routing matrix (l x k) for network; must be of full row rank 
prior 
list containing priors for lambda and phi; must have

lambda0 
numeric vector (length k) of time 0 prior means for OD flows 
sigma0 
numeric vector (length k) of time 0 prior standard deviations for OD flows 
phi0 
numeric starting value for phi at time 0 
rho 
numeric fixed autoregressive parameter for dynamics on lambda; see reference for details 
tau 
numeric fixed power parameter for variance structure on truncated normal noise; see reference for details 
m 
integer number of particles to use 
verbose 
logical activates verbose diagnostic output 
Xdraws 
integer number of draws to perform for

Xburnin 
integer number of burnin draws to discard
for 
Movedraws 
integer number of iterations to run for each move step 
nThresh 
numeric effective number of independent particles below which redraw will be performed 
aggregate 
logical to activate aggregation of MCMC results; highly 
backward 
logical to activate reverse filtering (for smoothing 
tStart 
integer time index to begin iterations from 
list containing:
xList
lambdaList
phiList
y
rho
prior
n
l
k
A
A_qr
A1
A1_inv
A2
nEff
tStart
backward
aggregate
A.W. Blocker and E.M. Airoldi. Deconvolution of mixing time series on a graph. Proceedings of the TwentySeventh Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI11) 5160, 2011.
Other bayesianDynamicModel: buildPrior
;
move_step
Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.