  Origin-destination (OD) demand matrices are crucial for transit agencies to
design and operate transit systems. This paper presents a novel temporal
Bayesian model designed to estimate transit OD matrices at the individual
bus-journey level from boarding/alighting counts at bus stops. Our approach
begins by modeling the number of alighting passengers at subsequent bus stops,
given a boarding stop, through a multinomial distribution parameterized by
alighting probabilities. Given the large scale of the problem, we generate
alighting probabilities with a latent variable matrix and factorize it into a
mapping matrix and a temporal matrix, thereby substantially reducing the number
of parameters. To further encode a temporally-smooth structure in the
parameters, we impose a Gaussian process prior on the columns of the temporal
factor matrix. For model inference, we develop a two-stage algorithm with the
Markov chain Monte Carlo (MCMC) method. In the first stage, latent OD matrices
are sampled conditional on model parameters using a Metropolis-Hastings
sampling algorithm with a Markov model-based proposal distribution. In the
second stage, we sample model parameters conditional on latent OD matrices
using slice and elliptical slice sampling algorithms. We assess the proposed
model using real-world data collected from three bus routes with varying
numbers of stops, and the results demonstrate that our model achieves accurate
posterior mean estimation and outperforms the widely used iterative
proportional fitting (IPF) method. Additionally, our model can provide
uncertainty quantification for the OD demand matrices, thus benefiting many
downstream planning/operational tasks that require robust decisions.
