Author: team (author="team" in the registry)
Code: analyses/bus_bunching.py
Cards: bus-bunching ("Bus bunching: headway regularity")
Data: Stride /siri_vehicle_locations/list (actual GPS pings)
- How evenly spaced are consecutive buses? Measures headway regularity compared to the scheduled spacing.
- How often do buses run nose-to-tail (bunched) or leave long empty gaps (gapped)? Classifies consecutive arrival gaps to measure frequent-service reliability failures.
-
Resolve Route: Disambiguates
route_short_nameto itsline_refandoperator_refusing GTFS. -
Exclusion Filters: Skips Friday/Saturday weekend days. Clamps the date window back by 3 days (
LAG_DAYS) to ensure SIRI data has finished landing on the server. -
Fetch GPS Pings:
/siri_vehicle_locations/listfetches all GPS pings for the resolved line/operator for the sampled days (capped at 2 days to limit network cost). -
Identify Departures: Groups pings by ride and extracts the earliest
recorded_at_timeas the actual departure proxy (first_ping). - Calculate Gaps: Calculates actual headways (difference in minutes between consecutive actual departures) and scheduled headways.
-
Classify Regularity:
- Defines a "target headway" as the median of scheduled headways.
- Classifies each headway gap:
-
Bunched: actual gap
$< 0.25 \times \text{target headway}$ (buses running nose-to-tail). -
Gapped: actual gap
$> 1.75 \times \text{target headway}$ (the empty gap left behind). -
Normal: between
$0.25$ and$1.75 \times \text{target headway}$ .
-
Bunched: actual gap
-
Compute Statistical Variation: Calculates the overall Coefficient of Variation (
$C_v = \sigma / \mu$ ) of the headway gaps.
Why headway regularity and not lateness. On high-frequency urban lines, passengers do not plan their commutes around a specific timetable departure; they arrive at the station expecting a bus every, say, 10 minutes. If two buses arrive at minute 18 (bunched) and then no bus arrives until minute 38 (gapped), the service has failed in its primary promise, even if both vehicles are technically "on schedule" according to some loose timetabling. Headway regularity is the standard metric for frequent transit.
On busy Tel Aviv routes, over 30% of actual headways fall into the "bunched" category, and are immediately followed by an equal share of "gapped" headways, illustrating the severe headway-instability feedback loop under heavy passenger boarding loads.
Coarse departure proxy. Using the "earliest GPS ping" (first_ping) as a proxy for actual departure is highly sensitive to cellular network and on-vehicle transmission delay. If the tracking system on a bus starts transmitting only after the bus has been moving for 8 minutes, its "first ping" is recorded 8 minutes late. This introduces artificial variability into the derived headways that does not reflect physical departures.
Static headway target. Using the median of scheduled headways as a single "target" headway is a blunt instrument. A route may be scheduled for 8-minute headways during rush hours but drift to 25-minute headways at noon. Comparing a midday 25-minute headway to an 8-minute median scheduled headway would incorrectly flag it as "gapped." The target headway should be calculated dynamically based on the scheduled headway for that specific hour of day.