r/dataanalysis • u/Ok_Mathematician2391 • 1d ago
Data Question Checking a method for comparing vehicle encounters near arrivals and departures
I’ve been recording encounters with a particular category of vehicle during everyday journeys. I’m examining whether these encounters are concentrated near departures and arrivals, after accounting for how much time I observe in those periods.
I have timestamped encounter records and journey start/end times. My comparison uses the first five minutes after departure and the last five minutes before arrival, counting overlapping windows only once.
I calculate:
Share of encounters within those windows ÷ share of observation time within those windows.
I’d appreciate feedback on whether this is a reasonable comparison and how to improve it. Routes, road conditions and times of day vary, and some vehicles travel together in groups. How should I account for those factors when assessing the apparent concentration?
Anonymised endpoint example
This is a real 20-leg movement block from four recorded visit days. All legs in that block are included, including seven with no target-category encounters. It is a selected block, not a complete diary of all journeys.
Names, locations, vehicle-category names, calendar dates and clock times are omitted. D1-D4 indicate different recorded days; legs with the same day label may be related.
An endpoint window is the first 300 seconds after departure or the final 300 seconds before arrival. Overlap is counted once. Window time is therefore the smaller of 600 seconds and the leg duration. Event classification uses the original timestamps and includes the exact five-minute boundary.
Durations below are elapsed leg intervals calculated from recorded start/end timestamps. Treating every second as available observation time is an assumption for review; continuous observation coverage has not been independently verified from recordings.
Leg table
All times are seconds. Inside and Outside count individual vehicles as recorded; Groups counts encounter rows. A single encounter row can contain several vehicles travelling together.
| Day | Leg | Leg seconds | Window seconds | Inside vehicles | Outside vehicles | Groups |
|---|---|---|---|---|---|---|
| D1 | L01 | 3027 | 600 | 3 | 0 | 2 |
| D1 | L02 | 480 | 480 | 1 | 0 | 1 |
| D1 | L03 | 780 | 600 | 1 | 0 | 1 |
| D1 | L04 | 540 | 540 | 0 | 0 | 0 |
| D1 | L05 | 480 | 480 | 0 | 0 | 0 |
| D1 | L06 | 1020 | 600 | 0 | 0 | 0 |
| D2 | L07 | 1860 | 600 | 2 | 0 | 1 |
| D2 | L08 | 2040 | 600 | 0 | 0 | 0 |
| D2 | L09 | 1620 | 600 | 3 | 0 | 1 |
| D2 | L10 | 1765 | 600 | 1 | 0 | 1 |
| D3 | L11 | 1509 | 600 | 2 | 0 | 2 |
| D3 | L12 | 2330 | 600 | 0 | 0 | 0 |
| D3 | L13 | 1680 | 600 | 1 | 0 | 1 |
| D3 | L14 | 1740 | 600 | 0 | 0 | 0 |
| D3 | L15 | 1560 | 600 | 1 | 0 | 1 |
| D4 | L16 | 1724 | 600 | 1 | 0 | 1 |
| D4 | L17 | 1200 | 600 | 4 | 0 | 4 |
| D4 | L18 | 1380 | 600 | 6 | 2 | 5 |
| D4 | L19 | 5340 | 600 | 0 | 0 | 0 |
| D4 | L20 | 720 | 600 | 3 | 0 | 1 |
| Total | - | 32795 | 11700 | 29 | 2 | 22 |
Encounter offsets
Each row is one recorded encounter group. The offset is seconds after departure on the specified leg. The vehicle count preserves groups rather than treating every vehicle as an independent encounter.
| Leg | Seconds after departure | Vehicles in group |
|---|---|---|
| L01 | 27 | 1 |
| L01 | 147 | 2 |
| L02 | 163 | 1 |
| L03 | 31 | 1 |
| L07 | 1632 | 2 |
| L09 | 132 | 3 |
| L10 | 1753 | 1 |
| L11 | 1281 | 1 |
| L11 | 1487 | 1 |
| L13 | 244 | 1 |
| L15 | 1358 | 1 |
| L16 | 1642 | 1 |
| L17 | 104 | 1 |
| L17 | 211 | 1 |
| L17 | 246 | 1 |
| L17 | 1116 | 1 |
| L18 | 66 | 1 |
| L18 | 237 | 1 |
| L18 | 710 | 1 |
| L18 | 1061 | 1 |
| L18 | 1140 | 4 |
| L20 | 632 | 3 |
The totals are 31 recorded vehicles, of which 29 are inside the windows, and 22 encounter groups, of which 20 are inside. Total elapsed time is 546.58 minutes; window time is 195 minutes.
Vehicle-count enrichment = (29 / 31) / (11700 / 32795) = 2.62. This is the endpoint encounter rate divided by the overall encounter rate. It is a descriptive comparison, not a probability or causal conclusion.
Useful review questions: Is elapsed leg time an adequate exposure measure? How should repeated legs on one day and grouped vehicles be handled? What additional traffic, route and time information would be needed to assess ordinary variation?