Bayesian CAR Models for Road-Segment Traffic
Build segment adjacency from segment geometries
Build a road network graph from sf LINESTRING data
Static map of road-segment traffic measures
Quick map helper for augmented roads
Posterior predictive checks for trafficCAR fits
Prepare speed outcome for Gaussian modeling
Prepare travel time outcome for Gaussian modeling
Residuals for trafficCAR fits
Coerce/validate adjacency matrix as sparse with zero diagonal
Augment roads with predicted traffic quantities
Draw from a multivariate normal with sparse precision
CAR precision matrix from an adjacency matrix
Connected components and isolates from an adjacency matrix
Degree matrix from adjacency
Extract draws from a base fit object (adapter) EDIT FIELDS LATER
Summarize draws into mean and equal-tail interval
Fetch road geometries from OpenStreetMap
Fit Gaussian CAR / ICAR regression via Gibbs sampling
Example road network datasets
Fit a Gaussian CAR traffic model (speed or travel time)
Apply sum-to-zero constraint to ICAR precision
Intrinsic CAR (ICAR) precision matrix
Load road geometries from sf object or file
Interactive map with multiple standard traffic layers
Interactive map of road-segment traffic measures
Moran's I for trafficCAR residuals
MCMC diagnostic plots
Plot observed vs predicted traffic values
Plot predicted traffic outcome on road network
Plot relative congestion on road network
Convert road geometries to modeling segments
Row-standardize adjacency matrix
Sample ICAR random effects with component-wise sum-to-zero constraints
Gibbs sampler for a proper CAR latent Gaussian model
Simplify a built network object by removing parallel edges (and loops)
trafficCAR: Bayesian CAR Models for Road-Segment Traffic
Gibbs update for beta in y = X beta + x + eps
Optional Gibbs update for sigma2 with Inv-Gamma prior
Construct spatial weights matrix
Tools for simulating and modeling traffic flow on road networks using spatial conditional autoregressive (CAR) models. The package represents road systems as graphs derived from 'OpenStreetMap' data <https://www.openstreetmap.org/> and supports network-based spatial dependence, basic preprocessing, and visualization for spatial traffic analysis.