# Daily ridership forecasting

After Chicago transit ridership collapsed in March 2020, repeating last week's count for the same weekday missed less than gradient boosting in every month, by about 45,000 boardings a day (95% range 20,000 to 82,000), but exponential smoothing missed less than it in every month from August to December. Averaged over March to December, last week's count missed by about 49,000 boardings a day and gradient boosting, the model with the lowest error in January and February, by about 95,000.

This study compares four one-day-ahead forecasts of the Chicago Transit Authority's public daily boarding count on every day of 2020, each made with only what was known the evening before. It turns the result into a monitoring rule: keep the simple forecast as the baseline, score every model against it each week, and raise an alarm when the real count leaves the forecast's 90% range. The public series stands in for the daily demand a marketplace or delivery operation schedules supply against, so no customer data is shared.

Open [report.html](report.html) for the full study: the result in plain words, the evidence, what went wrong, the monitoring rule, which method to use when, a rollout plan with owners and effort, what it is worth in US$ across low, middle and high assumptions, and where AI fits.

## Results

Average miss per day (mean absolute error), boardings, rounded to thousands:

| Method | January to February | March to December | Full year |
| --- | ---: | ---: | ---: |
| Last week's count | 114,000 | 49,000 | 60,000 |
| Exponential smoothing (ETS) | 102,000 | 72,000 | 77,000 |
| Gradient boosting | 80,000 | 95,000 | 92,000 |
| Calendar regression | 102,000 | 558,000 | 483,000 |

- Before the collapse no pair of methods differs clearly; 60 days are too few.
- After it, averaged over March to December, last week's count is clearly ahead of gradient boosting (adjusted p = 0.010) and calendar regression (adjusted p <0.001). Its lead over exponential smoothing (ETS) could be chance (adjusted p = 0.14), and so could its full-year lead (adjusted p = 0.28); ETS missed less in every month from August to December.
- The 90% ranges for last week's count held 89.6% of days over the year but only 70.0% in June. Calendar regression sees no recent counts, so after March it kept forecasting pre-pandemic ridership; in January it had the lowest error of the four.
- Replayed unchanged, the monitoring rule's break alarm fired 2 days after the March 2020 drop (the rule was written after seeing 2020, so 2019 is the real test). In 2019, a year with no break, it fired 5 times, 4 of them around holidays, and the range alarm was on for 16% of days. In 2019 gradient boosting had the lowest error and last week's count the highest.

## Limits

One city's transit counts through one shock year, with 2019 as the only normal-year check, so it is not a general rule for shocks. The counts are boardings, not unique riders, from the current published version of the data, and the replay assumes each day is known at its close. No weather data are used. March is a descriptive split, not a causal date.

## Files

- [results.json](results.json): every daily forecast, fit and summary metric from the backtest.
- [predictions.csv](predictions.csv): the 1,464 daily forecasts with observed counts and 90% ranges.
- [findings.json](findings.json): the follow-up paired tests and the log-scaled ranges.
- [assets/comparison.svg](assets/comparison.svg): average miss by month and method.
- [data/manifest.json](data/manifest.json) and [NOTICE.txt](NOTICE.txt): data source, terms and the City's required disclaimer.

## Reproduce

Use Python 3.12 and uv. Bootstrap downloads only the hash-pinned packages; the licensed source CSV is included. Run from this directory. After bootstrap, no credentials or network are needed.

```sh
python3.12 -m venv .venv
uv pip install --python .venv/bin/python --require-hashes -r requirements.lock
make test
make findings
make preview
```

`make test` runs constructed numerical and isolation fixtures. `make findings` reruns the follow-up tests and log-scaled ranges from results.json. Run one step at a time. The preview is at http://127.0.0.1:8055/report.html.

## Data terms

The study uses real aggregate boarding counts; the tests use constructed synthetic counts. The CTA's purpose-limited terms and the City of Chicago's required disclaimer apply ([NOTICE.txt](NOTICE.txt)); no endorsement is implied. The page uses a vendored copy of a shared design kit (vendor/viz-design-system, fonts under the SIL Open Font License).

Some files are packed in daily-demand-forecasting-data-1.zip; unzip it here to restore the full export, which the manifest lists file by file.
