trafficCAR0.1.0 package

Bayesian CAR Models for Road-Segment Traffic

build_adjacency

Build segment adjacency from segment geometries

build_network

Build a road network graph from sf LINESTRING data

plot_roads_static

Static map of road-segment traffic measures

plot_traffic_map

Quick map helper for augmented roads

ppc_summary

Posterior predictive checks for trafficCAR fits

prep_speed

Prepare speed outcome for Gaussian modeling

prep_travel_time

Prepare travel time outcome for Gaussian modeling

residuals.traffic_fit

Residuals for trafficCAR fits

as_sparse_adjacency

Coerce/validate adjacency matrix as sparse with zero diagonal

augment_roads

Augment roads with predicted traffic quantities

rmvnorm_prec

Draw from a multivariate normal with sparse precision

car_precision

CAR precision matrix from an adjacency matrix

components_from_adjacency

Connected components and isolates from an adjacency matrix

degree_matrix

Degree matrix from adjacency

dot-extract_gaussian_draws

Extract draws from a base fit object (adapter) EDIT FIELDS LATER

dot-summarize_draws

Summarize draws into mean and equal-tail interval

fetch_osm_roads

Fetch road geometries from OpenStreetMap

fit_car

Fit Gaussian CAR / ICAR regression via Gibbs sampling

roads_datasets

Example road network datasets

fit_traffic

Fit a Gaussian CAR traffic model (speed or travel time)

icar_sum_to_zero

Apply sum-to-zero constraint to ICAR precision

intrinsic_car_precision

Intrinsic CAR (ICAR) precision matrix

load_roads

Load road geometries from sf object or file

map_roads_interactive_layers

Interactive map with multiple standard traffic layers

map_roads_interactive

Interactive map of road-segment traffic measures

moran_residuals

Moran's I for trafficCAR residuals

plot_mcmc_diagnostics

MCMC diagnostic plots

plot_observed_fitted

Plot observed vs predicted traffic values

plot_predicted

Plot predicted traffic outcome on road network

plot_relative_congestion

Plot relative congestion on road network

roads_to_segments

Convert road geometries to modeling segments

row_standardize_weights

Row-standardize adjacency matrix

sample_icar

Sample ICAR random effects with component-wise sum-to-zero constraints

sample_proper_car

Gibbs sampler for a proper CAR latent Gaussian model

simplify_network

Simplify a built network object by removing parallel edges (and loops)

trafficCAR-package

trafficCAR: Bayesian CAR Models for Road-Segment Traffic

update_beta_gaussian

Gibbs update for beta in y = X beta + x + eps

update_sigma2_ig

Optional Gibbs update for sigma2 with Inv-Gamma prior

weights_from_adjacency

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.

  • Maintainer: Madison Ell
  • License: MIT + file LICENSE
  • Last published: 2026-01-27