Should a Galway school bus leave earlier on wet mornings?
Should a Galway school bus leave earlier on wet mornings? Your team has a sample of journey times from one school week. Before recommending a change, can you tell what those times support and what they leave uncertain?
You’ve counted how often each value occurs. Those counts help you find the mode: look for the most frequent value. For the mean, divide the total by the number of values. For the median, sort the values. Take the middle value, or average the middle two if the list length is even.
Start with an empty list for each weather label. For each cleaned record, use its weather label to put its duration into the right list. Skip empty lists. For each remaining list, count the journeys, tally the frequencies, and find the mean, median and mode. Print them together.
A journey record says wet, twenty-six minutes, and cross-town route. The code groups by weather for this comparison. Where should that duration go? Pick the option that follows the grouping rule.
Sort the three wet times and pick the middle one, twenty-four minutes. Now sort the five dry times and pick their middle value, eighteen minutes. Subtract the dry median from the wet median. The wet median is six minutes higher.
Your next sample has wet times of twenty and twenty-eight minutes. The dry times are fourteen, sixteen and eighteen minutes. Find each median, then pick how much higher the wet median is.
Now put the medians on a bar chart. The wet bar reaches twenty-four minutes and represents just three journeys. The dry bar reaches eighteen minutes and represents five journeys. Put the counts next to the weather labels so readers can see how much data each median is based on.
It's tempting to say rain caused every delay. But two of the three wet journeys crossed town, compared with one of the five dry journeys. Route differences could explain some of the gap. Eight trips from one week may also give a poor picture of the rest of the term.
In your report, cite the bar chart: the wet median was six minutes higher. Eight journeys on different routes in one week can’t establish what caused the gap. Recommend trialling an earlier departure on one route on wet mornings. Compare the proportions arriving late with similar wet mornings at that route’s usual departure time.