Posts / A Month of Liguria's Trains: What 22,641 Trips and 231,504 Arrivals Say About the Network

A Month of Liguria's Trains: What 22,641 Trips and 231,504 Arrivals Say About the Network

Why look at the data

Sometimes in Italy, a station has no screen at all, no information about the trains coming. Only the speaker. That is where my train tracking project comes from, and its goal is to turn macro data into micro data: the official source only says “this train was seen at this station, N minutes late”, and between two stations there is nothing. I want to estimate where a train is along the track, even far from any station.

A model needs data, so step one was the collector: a small server that asks ViaggiaTreno, the Italian railways information service [1], about the trains of the area around Genoa and writes everything in a SQLite database. It has been running since 12 October. I recorded everything without knowing exactly which questions I would ask later, and this post is the first time I ask them.

This is step two: study the data before modelling it. Not to prove anything, but to know what I am working with and what the model will have to beat. What runs, and when? What does the area look like? How late are the trains, at which hour, in which station, on which section? Does a train that leaves late stay late? Every number comes with the quantity behind it, and every symbol of every equation is defined where it appears.

Eight numbers to impress at dinner

If you keep only one section, keep this one. Each number is explained further down.

43
trains at once, at the peak
The busiest moment of a weekday is 18:20, with 43 trains on the network at the same time. The morning rush is just below (41 around 07:40).
7 of 94
stations carry half the trains
Half of all the train starts and ends happen in 7 stations. Genova Brignole alone sees about 148 a day.
−36 %
regional trains on Sunday
399 against about 623 on a weekday. Intercity trains do not care: about 45 a day, seven days a week.
30 %
of arrivals are early
50 % are within 5 minutes after the timetable and only 20 % are more than 5 minutes late. The median delay is +1 minute.
+1.7 min
gained between two stations
Between two neighbouring stations, a train adds delay in only 7.6 % of the runs.
×2.5
risk after a late start
Late at the end 32 % of the time, against 13 % for a train that left on time. But it recovers about 6 minutes on the way (from +11.6 to +5.6).
32 %
of arrivals over 5 min late, Tuesday at 18:00
The worst busy hour of the week, just ahead of Thursday at 18:00 (31.6 %). Later at night the rate is higher, but on far fewer trains.
13,000 km
of trains a day
Add up the length of every section each train goes through: the circumference of the Earth every three days. It is a floor, since a train that skips a station is not counted. The busiest section, Genova Piazza Principe to Brignole (2.4 km), sees about 240 trains a day.

The data

Two tables

The collector writes two tables that matter here. A row of trains is one train on one service day. A row of stops is one station on the route of one train.

-- trains: one row = one train on one service day
number         -- the train number, e.g. 3277
category       -- REG, IC, ICN, FR, FA, FB, EC...
departure_ms   -- midnight of the service day, not an hour
origin, destination
first_seen     -- when the collector found the train
last_poll      -- the last time it asked about it
n_polls        -- how many times it asked
status         -- done | lost | cancelled | active
-- stops: one row = one station on the route of one train
train_id, seq, station, station_name
sched_arr      -- scheduled arrival
real_arr       -- real arrival (empty if never reported)
delay_arr      -- announced delay, in minutes
sched_dep, real_dep, delay_dep    -- the same for the departure

Here is the REG 3277 of 19 November, from Genova Brignole to La Spezia Centrale, as the database holds it. First its row in trains:

number=3277  category=REG  status=done  n_polls=23
origin=GENOVA BRIGNOLE  destination=LA SPEZIA CENTRALE
departure_ms=19 Nov 2026 00:00  first_seen=15:07  last_poll=18:28

Then some of its rows in stops, the arrival side first:

seqstation_namesched_arrreal_arrdelay_arr
0GENOVA BRIGNOLENULLNULL0
1GENOVA NERVI16:5717:004
4RAPALLO17:18NULL0
6SESTRI LEVANTE17:3417:4612
10LA SPEZIA CENTRALE18:1018:2112

and the departure side of the same rows:

seqsched_depreal_depdelay_dep
016:4516:483
116:5817:025
417:1917:2911
617:3517:4814
10NULLNULL0

The delay grows along the way, from 3 minutes at the origin to 12 at the terminus. The first row has no arrival (a train does not arrive at its origin) and the last has no departure.

In total the database holds 22,641 trains (961 distinct numbers), 326,584 stops and about 420,000 polls. Three details of these two tables shape everything that follows:

  • departure_ms is not an hour. It is midnight of the service day. The hour of the day for the volumes is rebuilt from the stops of the train: from its first to its last stop in the network. (first_seen to last_poll is not used: the collector finds a train long before it leaves and keeps asking after it arrives, so that window made the day look about three times busier than it is.) For the delays, the hour is the one of sched_arr, which is exact.
  • delay_arr = 0 is not always a measurement. When the feed never says that the train arrived (real_arr is empty, like Rapallo above), the delay is stored as 0. That is the case of 72,430 stops out of 326,584. Every delay in this study is computed on the 231,504 stops with a real_arr.
  • The collector did not always watch the same area. More on that in the next section.

The frame: a network of 105 stations

The area of the study is the network of the project: 105 stations, each with its GPS position, and 126 sections, the segments of line between two neighbouring stations. Together they make 556 km of line, 198 km from west to east and 98 km from north to south. The geometry comes from OpenStreetMap, extracted by the pipeline of the project; there are no map tiles in this post, the lines drawn are the data. Fig. 1 shows it.

Fig. 1 - The 105 stations and 126 sections of the network. The width of a section is its number of tracks. Rail geometry and stations: © OpenStreetMap contributors (ODbL).

The same graph, with the colour of each section telling how busy it is (Fig. 2), shows where the trains actually run:

Fig. 2 - Trains per day on each section, over the 30 full days. Each dot is a station at its real position; a grey link is a section no recorded train went through. The busiest section, Genova Piazza Principe to Brignole, sees about 240 trains a day. Rail geometry and stations: © OpenStreetMap contributors (ODbL).

One section stands out: Principe to Brignole, with 242 trains a day, where the lines of the Genova junction meet. Every other section stays under 90: 60 to 90 around Genova and on the Levante up to La Spezia, about 50 on the Ponente, and 10 to 30 on the lines going inland (Savona to Cairo, Genova to Ronco Scrivia, Rossiglione).

Of the 126 sections, 85 have two tracks (353 km), 33 have one (184 km), 7 have three and 1 has four. A section is the unit used later to locate where a delay builds up or is recovered.

The frame also settles a question about what a delay means. Long-distance trains report their stops far outside Liguria, in Tuscany or in Puglia, where a delay says little about the Ligurian network. So every delay figure keeps only the stops of the 105 stations: 103,384 of the 201,310 stops with a real arrival in the 30 full days, 51 %.

Which days

Fig. 3 - Trains followed per day. Until 19 October the collector watched about 320 trains a day, then the whole area, about 700 on a weekday (660 over all days). Only the blue days are used in the study. The dashed line is the median of the last 14 full days, the dotted line nine tenths of it. The last day is still being collected, so it is left out.

As Fig. 3 shows, until 19 October the collector saw less than half of the trains, and any average mixing those days with the others would be wrong. The rule is simple: the recent level is the median of the last 14 full days (the day still being collected is not counted). The first day to reach nine tenths of it is a transition and is skipped, and the study starts the day after. Weekends fall below that line without leaving the study: it only dates the day the collector began to watch the whole area.

$$ n_d \ge 0.9\,\tilde n \quad \text{Eq (1)} $$
  • $n_d$ is the number of trains followed on day $d$;
  • $\tilde n$ is the median of $n_d$ over the last 14 days, the level the collector has now.

That leaves 30 full days, from 21 October to 19 November: 22 weekdays, 4 Saturdays and 4 Sundays. The weekly and daily profiles use the last two weeks only, so that no change of service falls inside them.

How much the stations tell

Everything that follows rests on the feed saying when a train reached a station. It does not do so everywhere, and that limits what the delay figures can say. For each of the 163,315 stops of a train at one of the 105 stations (over the 30 full days), the feed can give a real time of arrival (real_arr) and a real time of departure (real_dep).

63 %
of stops have a real arrival time
Against 90 % with a real departure time: the feed gives the departure much more often than the arrival.
42 · 41 · 14
stations: always · never · sometimes
A station nearly always gives the arrival (42), or never (41), or in between (14). The 41 silent ones carry 30 % of the stops and give a departure time instead.
95 %
of the last stops in the network have a real arrival
And 99 % of the first stops have a real departure: the two ends of a journey are the best known part of it.
31 % · 15 %
of stops at a silent station: regional · fast trains
Regional trains stop at more of the silent stations. Over all stops, 62 % of the regional stops have a real arrival time against 80 % for intercity and high-speed trains. At the 22 stations where both kinds stop, it is 70 % against 80 %: about half of the gap comes from where they stop, not from the kind of train.
Fig. 4 - Share of stops with a real arrival time, at each station. Dark: the station gives it almost always; pale: almost never (it gives the departure). The size of a dot is the number of stops. Rail geometry and stations: © OpenStreetMap contributors (ODbL).

Fig. 4 maps the share of stops with a real arrival time, station by station. The departure tells another story (Fig. 5):

Fig. 5 - Share of stops with a real departure time, at each station. 73 stations give it almost always, 18 in between and only 6 never. Rail geometry and stations: © OpenStreetMap contributors (ODbL).

Put together, the stops fall into four groups:

  • 57 % have both a real arrival and a real departure time;
  • 33 % have only the departure;
  • 6 % have only the arrival;
  • 3 % have neither.

A study by departure would see 90 % of the stops instead of 63 %. I used the arrival because it is the time that says how late a train is for the people waiting, and kept the departure where it is needed: the first stop of a journey and the sections between two stations.

What it changes for the rest of the study:

  • The delay figures use arrivals. They cover the 63 % of stops that have one, 103,384 stops, and the 41 silent stations are almost all absent from the rankings by station.
  • The big stations are in between. Genova Piazza Principe gives the arrival in 93 % of its stops, Brignole in 71 %, Savona and La Spezia Centrale in 64 %. I do not know whether the trains with no arrival time there are different from the others (later, earlier), so the delay at these stations is the delay of the trains that were measured.
  • A few trains disappear on the way. 116 of the 14,983 trains (0.8 %) are marked lost: the feed stopped answering before they arrived. They are left out of the journeys.
  • The collector sees each train about every 15 minutes, 13 times on a median train.

What runs

The week

Fig. 6 - Mean number of trains per day of the week, per kind of train (6 to 19 November). Weekdays in blue, weekend in orange.

Fig. 6 gives the mean number of trains per day of the week. The weekend effect of a kind of train is its Saturday (or Sunday) count against the mean of the five weekdays.

$$ \Delta_{\text{Sat}} = \frac{\bar n_{\text{Sat}}}{\bar n_{\text{Mon-Fri}}} - 1 \quad \text{Eq (2)} $$
  • $\bar n_{\text{Sat}}$ is the mean number of trains over the Saturdays of the window;
  • $\bar n_{\text{Mon-Fri}}$ is the mean number of trains per day over the weekdays;
  • $\Delta_{\text{Sat}}$ is the relative change: $-0.15$ means 15 % fewer trains on Saturday. The same formula with Sundays gives $\Delta_{\text{Sun}}$.

Over all trains it gives -15 % on Saturday and -33 % on Sunday. Regional trains, which are 91 % of the data, run at about 622 to 626 a day from Monday to Friday, drop to 526 on Saturday (-16 %) and 399 on Sunday (-36 %). The intercity trains (IC, ICN, EC…) ignore the weekend completely: about 45 a day, seven days a week. The high-speed trains are the opposite: 16 to 18 a day from Monday to Thursday, then about 10 from Friday on. With 10 to 18 trains a day, this last profile rests on small numbers.

The day

Counting how many trains are on the network at the same time draws the day.

$$ C(t) = \sum_{i} \mathbf{1}\left[\, s_i \le t \le e_i \,\right] \quad \text{Eq (3)} $$
  • $i$ is one train, $s_i$ the time of its first stop in the network and $e_i$ the time of its last one (the real time when the feed gives it, else the scheduled one): the window during which the train runs on the 105 stations;
  • $\mathbf{1}[\cdot]$ is the indicator: 1 if the condition inside is true, 0 otherwise;
  • $C(t)$ is therefore the number of trains running on the network at time $t$. A long-distance train counts only for the part of its journey inside the area.
Fig. 7 - Trains on the network at the same time, C(t), mean over 6 to 19 November, by 10 minutes. A train counts from its first to its last stop in the network.

In Fig. 7, a weekday has two humps and a dip: about 41 trains at the same time around 07:40, a dip to about 24 around 09:30, then a long plateau of 35 to 40 trains that reaches the day’s maximum, 43 trains at 18:20. Morning and evening are close; the evening is slightly higher. The weekend is flatter and the evening clearly wins: on Sunday, about 22 trains at 08:00 against 30 at 17:40. Between 01:00 and 04:00 there is almost nothing, 0 to 4 trains at a time.

Where trains start and end

Fig. 8 - Trains starting or ending at each station, mean per day over the 30 full days.

In Fig. 8, Genova Brignole comes first with about 148 trains a day starting or ending there, then La Spezia Centrale (133), Alessandria (111), Savona (107) and Sestri Levante (85). Genova Piazza Principe, the other big Genoa station, is only tenth with 33: this counts the first and last station of each train, so a station many trains pass through is under-counted by construction. The busiest routes, in both directions, are Savona and Sestri Levante (about 39 trains a day), Alessandria and Pavia (26) and La Spezia Centrale and Sestri Levante (26).

To measure how concentrated this is, rank the stations from the busiest and add them up one by one.

$$ S(k) = \frac{\sum_{j=1}^{k} c_{(j)}}{\sum_{j} c_{(j)}} \quad \text{Eq (4)} $$
  • $c_{(j)}$ is the number of trains starting or ending in the $j$-th busiest station, so $c_{(1)} \ge c_{(2)} \ge \dots$;
  • $k$ is how many stations are counted, starting from the busiest;
  • $S(k)$ is the share of all the starts and ends carried by these $k$ stations. It goes from near 0 to 1.
Fig. 9 - Reading the curve: the point at k = 5 says that the 5 busiest stations carry 44 % of all the train starts and ends; the orange lines show that 7 stations are enough to reach half. 94 stations have at least one train starting or ending there.

Fig. 9 shows a very concentrated distribution: $S(5)$ is 44 %, $S(10)$ is 63 %, and half of all starts and ends happen in 7 stations out of 94. Past the fortieth station the curve is flat: the other 54 stations carry less than 3 %.

How train numbers repeat

A train number is a service that comes back on the days it is scheduled. Counting on how many of the 30 days each number ran gives a distribution with sharp peaks instead of a bell.

Fig. 10 - Train numbers by the number of days they ran, out of the 30 full days. Dark bars: the timetable patterns, from the right: every day (30 days), Monday to Saturday (26), Monday to Friday (22), Saturday and Sunday (8), one weekend day (4). Light bars: numbers that started or stopped during the month, or that run on irregular days.

The peaks of Fig. 10 are the timetable showing through: 284 numbers ran all 30 days, 125 ran 26 days (Monday to Saturday), 180 ran 22 days (Monday to Friday), 59 ran 8 days (both weekend days) and 76 ran only 4 days (one weekend day). Over the last two weeks, 351 of 885 numbers ran every day of the week, 201 only from Monday to Friday, 120 from Monday to Saturday and 163 only at the weekend.

A timetable change the data caught

Weekdays hold at about 733 trains until the end of October, then at about 683 from 2 November, 7 % fewer. Nothing changed in the collector, so the change is in the trains. Comparing the train numbers of the first complete Monday-to-Friday week (26 to 30 October) with the last one (9 to 13 November) shows what moved.

Fig. 11 - Train numbers present in the week of 26 October but not in the week of 9 November (left) and the reverse (right), by route.

Fig. 11 shows the change: 55 numbers disappeared and 30 appeared. Of the 55, 29 are on the La Spezia Migliarina and Levanto line, and 44 ran for the last time on 1 November. Of the 30 new numbers, 24 are on La Spezia Centrale and Pietrasanta, all regional trains. It looks like a change of service on the Levanto and La Spezia section, with new trains going the other way out of La Spezia, towards Tuscany. The data shows what changed and when, not why.

How late it runs

The delay and its distribution

The delay of a stop is the one announced at the real arrival, in minutes. A stop is late when the delay exceeds 5 minutes, the threshold used throughout the project, and the late rate of a group of arrivals is the share of late ones.

$$ d = t_{\text{real}} - t_{\text{sched}}, \qquad \ell = \mathbf{1}\left[\, d > 5 \,\right], \qquad r = \frac{1}{N}\sum_{i=1}^{N} \ell_i \quad \text{Eq (5)} $$
  • $t_{\text{real}}$ and $t_{\text{sched}}$ are the real and the scheduled arrival of a train at a station (real_arr and sched_arr); their difference $d$ is the delay in minutes, which is what delay_arr stores. It is negative when the train is early;
  • $\ell$ is 1 when the arrival is late (more than 5 minutes), 0 otherwise;
  • $N$ is the number of arrivals in the group studied, $\ell_i$ the value of $\ell$ for the arrival $i$, and $r$ the late rate of the group.
Fig. 12 - Delay at arrival over the 103,384 arrivals of the network, 21 October to 19 November. One bar per minute, the last bar groups 30 minutes and more. The area of each colour is its share of the arrivals; the orange area is the late rate r.

In Fig. 12, the distribution is asymmetric: the median delay is +1 minute, the mean +3.0 and the 90th percentile +9. The area under the curve is the whole story: 30 % of the arrivals are early, 50 % are within 5 minutes after the timetable, and the orange tail holds 20 %: the late rate $r$ of the network. 4.3 % are more than 15 minutes late, 1.3 % more than 30 minutes and 0.26 % more than an hour. Arriving early is a feature of the Italian timetable (a train can reach a station before its scheduled time, but should not leave before it). Most of the mass sits within 5 minutes of the timetable; the problems live in the tail.

Through the day and the week

Fig. 13 - Share of late arrivals, by scheduled hour of arrival, weekdays and weekends.

On weekdays (Fig. 13) the late rate is lowest early in the morning (9.5 % late at 05:00) and rises through the day, with a small bump at 09:00 and a maximum of 29 % late at 18:00, among the hours with real traffic. Past 22:00 it climbs again (33 % at 23:00), on few trains. The weekend has the same shape, lower: 4.8 % late at 07:00 on a weekend morning, 21 % at the evening peak. Fig. 14 adds the day of the week: the mean delay by day and scheduled hour.

Fig. 14 - Mean delay at arrival by day of the week and scheduled hour (minutes). Cells with fewer than 30 arrivals are left out.
Fig. 15 - Share of arrivals more than 5 minutes late, by day of the week and scheduled hour. Cells with fewer than 30 arrivals are left out.

The same grid read as a late rate (Fig. 15) shows the same story: the weekday evening, 17:00 to 19:00, is the darkest band, with its peak on Tuesday at 18:00 (32 %), closely followed by Thursday at 18:00 (31.6 %), and the weekend mornings are the lightest. The late night is dark too (36 % on Monday and Thursday at 23:00), but those cells hold few arrivals.

Fig. 16 - Share of late arrivals per day. Weekdays in blue, weekends in orange.

Day by day (Fig. 16), the worst are 21 October (28.9 % late), 1 November (27.9 %, a Sunday, All Saints’ Day) and 12 November (26.8 %). The best days are all Sundays: 15 November (10.5 %), 8 November (11.2 %) and 25 October (11.8 %). The data cannot say what happened on the bad days; it says they are the ones to look at.

By kind of train

Fig. 17 - Share of late arrivals by kind of train, with the mean delay.

In Fig. 17, regional trains are late 18 % of the time (mean +2.7 minutes). Intercity and high-speed trains are late about twice as often: 36 % for the intercity (mean +6.0) and 38 % for the high-speed (mean +6.2, only 1,485 arrivals). A part of that is not the Ligurian network: these trains come from afar and arrive with a delay accumulated elsewhere.

Which stations

Fig. 18 - The eight stations with the highest and the lowest mean delay at arrival, among the 56 stations with at least 150 arrivals.

In Fig. 18, the latest stations are a mix of the coast west of Genoa, the Riviera di Ponente, and inland ones: Piana (+7.1 minutes, 47 % of the arrivals late), Alassio (+6.0, 43 %), Mele, Rocchetta Cairo, Finale Ligure Marina (+5.5) and Albenga (+5.2). Four of the eight latest are on that coast (Alassio, Finale Ligure Marina, Albenga, Pietra Ligure). The most on time are on the line from Genoa towards Milan and Turin: Busalla (-0.9 minutes, 6 % late), Genova Pontedecimo (-0.5) and Ronco Scrivia (+0.2). A station is not responsible for its own number: a delay is built before the train reaches it, so these figures describe where delays are more than where they start. One hypothesis does not hold: the Genoa stations are not worse than the others, with a mean of +3.0 minutes against +3.1 elsewhere.

Fig. 19 - Mean delay at arrival at each station of the network. The colour is the mean delay, the size of the dot the number of arrivals. Rail geometry and stations: © OpenStreetMap contributors (ODbL).

On the map (Fig. 19), the darkest dots (the latest stations) form a continuous stretch of the coast between Savona and Imperia, plus the branch towards Piana and Mele inland.

Where a delay builds and where it is recovered

Because the project has the topology of the network (the stations with their GPS positions and the sections between them), a delay can be located between two neighbouring stations. For a train leaving station $i$ and arriving at its neighbour $j$, the delay added on the section is:

$$ a_{ij} = d^{\text{arr}}_{j} - d^{\text{dep}}_{i} \quad \text{Eq (6)} $$
  • $d^{\text{dep}}_{i}$ is the delay of the train when it leaves $i$ (delay_dep);
  • $d^{\text{arr}}_{j}$ is its delay when it reaches the next stop $j$ (delay_arr);
  • $a_{ij}$ is what the train added on the section. A negative $a_{ij}$ means it gave time back.

Only pairs of consecutive stops of a train that are a section of the network count, and an $a_{ij}$ is clipped between -20 and +40 minutes, since a few runs of 100 minutes are a train waiting rather than a section. Over 66,878 runs between neighbouring stations, the mean is -1.7 minutes and the median -2: only 7.6 % of the runs add delay. Trains recover time almost everywhere, which is what a timetable with slack in its running times produces (an interpretation, the data only shows the effect).

Fig. 20 - Mean delay added between two neighbouring stations: green sections give time back, orange ones add delay (sections with at least 30 runs, the others in grey). Rail geometry and stations: © OpenStreetMap contributors (ODbL).

In Fig. 20, the sections that give back most are Bonassola to Levanto (-5.0 minutes, 656 runs), Borghetto Santo Spirito to Loano (-4.4), Quiliano-Vado to Savona (-4.1) and Recco to Camogli (-4.1). The only section that adds a noticeable delay is Santa Margherita Ligure to Rapallo, +1.0 minute on 1,301 runs.

Fig. 21 - Mean delay added per section, by number of tracks (sections with at least 30 runs).

Does the number of tracks matter (Fig. 21)? A little, and in the expected direction: single-track sections give back 1.5 minutes on average, double-track ones 1.7 and three-track ones 2.1. The gap is a few tenths of a minute, far less than the differences between stations.

Along a journey

A section is one step; a journey is the sum of them. A train carries its delay from station to station, and two questions follow. When a train leaves late, how much of the delay does it recover on the way? And does a late start still mean a late end? Take the trains whose origin is in the network, so that their departure delay is measured, and follow the delay from the departure to the last stop in the network.

$$ g = d_{\text{dep}} - d_{\text{end}} \quad \text{Eq (7)} $$
  • $d_{\text{dep}}$ is the delay at the departure from the origin (delay_dep of the first stop);
  • $d_{\text{end}}$ is the delay at the last stop of the train inside the network (delay_arr of the last stop);
  • $g$ is the time recovered on the journey, in minutes: positive when the train arrives less late than it left, negative when it loses time.

The delay along the journey and the time recovered are in Fig. 22.

Fig. 22 - Left: the mean delay along the journey, for the trains that left their origin late (more than 5 min) and those that left on time; the journey is cut in five equal parts by its stops. The gap between the two ends of the orange line is the time recovered. Right: the share of trains that are late at their last stop in the network.
+11.6 → +5.6
min, trains that left late
351 trains with at least 10 measured stops: the mean delay at the departure and at the last stop.
6.1 min
recovered on the way
Steadily along the journey, not in one go.
+2.0 → +3.5 → +2.4
min, trains that left on time
At the start, in the middle and at the end: the delay builds up in the middle and is partly recovered at the end.
38 %
of trains improve by more than 2 min
39 % stay within 2 minutes and 22.5 % get worse by more than 2. The delay at the start and at the end go together (correlation 0.53).

The second question is a conditional probability. Among the 7,595 trains whose origin is in the network (with at least 4 measured stops), 12.3 % leave late. For $x = 1$ (left late) or $x = 0$ (left on time):

$$ P(\ell_{\text{end}} = 1 \mid \ell_{\text{dep}} = x) = \frac{\text{trains with } \ell_{\text{dep}} = x \text{ and } \ell_{\text{end}} = 1}{\text{trains with } \ell_{\text{dep}} = x} \quad \text{Eq (8)} $$
  • $\ell_{\text{dep}}$ is 1 when the train left its origin late ($d_{\text{dep}} > 5$), 0 otherwise;
  • $\ell_{\text{end}}$ is 1 when it is late at its last stop in the network ($d_{\text{end}} > 5$);
  • the left side reads the probability of being late at the end, knowing how the train left, estimated here by a simple count over the trains.

A train that leaves late is late at the end 32 % of the time, against 13 % for a train that left on time: 2.5 times more likely. But two thirds of the trains that leave late do get back within 5 minutes: the slack of the sections works on the whole journey.

Repeat offenders

Some train numbers are late much more often than others. Keeping the 361 numbers followed on at least 20 runs, here are the extremes, measured at the last stop in the network.

TrainRouteRunsMean delay at the endLate (over 5 min)
ICN 794Reggio di Calabria to Torino Porta Nuova22+23.9 min36 %
FA 8596Roma Termini to Genova Piazza Principe23+16.2 min78 %
REG 3277Genova Brignole to La Spezia Centrale30+12.9 min50 %
FB 8630Roma Termini to Genova Piazza Principe26+12.5 min54 %
REG 12410Sestri Levante to Savona21+12.4 min29 %
REG 12218La Spezia Centrale to Sestri Levante30-6.6 min0 %
REG 12397Savona to Sestri Levante26-5.8 min4 %

The distribution is wide: 82 of the 361 numbers (23 %) are late less than 5 % of the time, and 12 (3 %) more than half of the time. The two ends are not the same kind of train: the late ones are mostly long-distance trains that bring a delay from far away, and the on-time ones are mostly short regional trains, some of which arrive on average more than 5 minutes early.

Limits

This study describes a month of autumn in one area. Four limits matter when reading the figures:

  • A month is short. It is enough for the weekly and daily shapes, not for seasons, strikes or works. The Levanto change may be a winter timetable or a temporary one.
  • Some stations stay silent. A third of the stops have no real arrival time, and the stations that never give it are absent from the delay figures by station (see How much the stations tell).
  • A station is not the cause of its delay. The figures by station and by section say where delays are and where they change, not why.
  • Part of the delay is not Ligurian. Long-distance trains arrive late from elsewhere. The stops outside the network are left out, but the delay a train carries into the network stays.
  • The source is not officially documented. I read ViaggiaTreno through an interface that has no official documentation, only community notes [2], [3], and the figures are what the service publishes, not an audited record.

Quick remember

  • The network is busiest at 18:20 on a weekday, with 43 trains at once. Half of all the train starts and ends happen in 7 stations out of 94.
  • Sunday has 36 % fewer regional trains (399 against about 623 on a weekday). Intercity trains stay at about 45 a day.
  • Delays are small and lopsided: the median is +1 minute, 30 % of the arrivals are early, and only 20 % are more than 5 minutes late.
  • The worst busy hour is Tuesday at 18:00, with 32 % of the arrivals over 5 minutes late.
  • A train that leaves late is about 2.5 times more at risk of arriving late (32 % against 13 %), but it recovers about 6 minutes on the way.
  • This is one month in one area, recorded from ViaggiaTreno: it shows where and when, not why.

References

All the figures come from my own collector and my own analysis: there is no external dataset behind them. The references below cover the origin of the data and of the map.

  1. ViaggiaTreno, the Trenitalia train information service. viaggiatreno.it
  2. ViaggiaTreno API wiki: community notes on the interface, which has no official documentation. github.com
  3. Home Assistant, the ViaggiaTreno integration. home-assistant.io
  4. OpenStreetMap, copyright and licence: rail geometry and stations on the maps, © OpenStreetMap contributors. openstreetmap.org
  5. Open Data Commons, Open Database Licence (ODbL) 1.0: the licence of the OpenStreetMap data. opendatacommons.org