Dynamic Pricing for Ride-Hailing
DuckDB · XGBoost · Choice models · Natural experiment · Evolutionary game theory · Switchback design · Pricing API · Python · 19 tests
The business question
A ride-hailing platform sets a price for every area and every hour. Two populations answer it, and neither answers at once. Riders compare the app with its rival, and with not riding at all. Drivers look at what each part of the city paid yesterday and decide where to work today. A price that clears the market this evening changes where the drivers will be tomorrow, and that changes the price the platform will need then.
So the useful questions are dynamic. How much of the fare is the trip and how much is the market? How many requests will each zone get next week? How fast do riders switch apps when one becomes cheaper? And does the price that looks best today make supply and waits swing later? The same questions apply to any business that prices a perishable capacity under moving demand: car rental, delivery, parking, hotels, events.
The data
Every trip is public. New York’s Taxi and Limousine Commission publishes each Uber and Lyft trip with the time of the request and of the pickup, the zones, distance, time, the fare before fees, the driver’s pay, and since 5 January 2025 the congestion fee. This case reads 15 months, 301.6 million trips (December 2023 to April 2024, and September 2024 to June 2025), with DuckDB, one pass per month, in about a minute for the whole set.
A quality report runs on every month. It found what the documentation does not say: the time the car arrived is missing for 99.7% of Lyft trips until February 2025, and is filled only from March 2025 on, so the wait used here is pickup minus request, which exists for every trip; about 1% of trips have a pickup before the request and are left out of the waits.
The natural experiment comes from the platforms themselves. When the congestion fee started, Lyft credited riders the $1.50 fee on rides in the zone, from 5 to 31 January 2025, each credit valid for a week. Uber did not. The fee hits both apps alike inside the zone; the credit made Lyft cheaper there for about five weeks.
Try it
The simulator below uses the estimates of this case. The map shows trips, fare per mile and wait in each of the 263 taxi zones by hour. Change the price in an area and hour and see trips, revenue, the platform’s margin and the wait. Switch to the adaptation tab to see riders and drivers react day after day under three pricing policies, or plan an experiment.
Method
A fare model that separates the trip from the market. A log-linear base fare on distance, time, app and airport explains 79% of the variance of log fares. What is left, averaged by area and hour, is a dynamic price index. An XGBoost model with place and time on top shows how much a full pricing model gains.
A forecast made a week ahead. Trips per zone and hour for 253 zones, with only what is known a week before: calendar, holidays and lags of one to four weeks. Each test month, April to June 2025, is forecast by a model trained on everything before it, against two baselines: the same hour last week and the mean of the last four weeks.
Riders as an evolving population. The Lyft share among Uber and Lyft trips that start in each zone of the congestion zone is followed day by day. Three nested choice models compete: static choice, where the share depends only on today’s prices and waits; a logit dynamic with inertia, where the share moves part of the way toward that target each day; and replicator-like drift, where it never comes back. The inertia parameter decides between them. The credit is measured by difference in differences against zones outside the congestion zone, and the same calendar a year earlier, when there was no credit, serves as placebo.
Drivers as a second population, in a simulator. Six areas, calibrated on Lyft’s weekday evening peak from February to June 2025. Each day drivers move toward the areas that paid more than usual, by an exponential replicator whose speed is the one thing the public data cannot pin down, so it is varied. The wait responds to demand per driver with an elasticity of 0.21, estimated within zone and hour of the week. Riders follow the choice model above. The demand elasticity, -0.4 with a range of -0.2 to -0.6, comes from published estimates for Uber (Cohen et al., 2016). Three policies face a lasting 25% rise in demand in the congestion zone: a fixed price, a surge that clears the market every day, and the same surge smoothed.
An experiment the platform could run. Price policies interfere across riders and drivers, so a rider-level A/B test is biased. The planner uses switchback blocks and the observed variability of the hourly margin to give the smallest effect a test can detect.
Results
The fare. Out of sample, in June 2025, the base fare misses by 23.4% on average (mean absolute percentage error) and the full XGBoost model by 18.3%. Trips that start in the congestion zone cost 5% to 39% more than the same distance and time would cost on average, depending on the hour, highest late at night; in the Bronx, Queens and Staten Island trips run at 0.84 to 1.02 of that level.
The forecast. A week ahead, the XGBoost model’s error (WAPE) averages 13.1% over the three test months, against 16.1% for the same hour last week and 13.0% for the mean of the last four weeks. The four-week mean is a hard benchmark at this horizon, and the model only ties it.
The riders. The data choose the middle model. The daily inertia is 0.61 (95% interval 0.58 to 0.64): the share closes about 39% of the gap to its target each day, a half-life of about 1.4 days. Relative price and wait matter as expected: one extra minute of Lyft wait against Uber lowers Lyft’s log-odds share by 0.08. The credit, however, left no measurable mark. Inside the zone, Lyft’s share rose by 0.021 in log-odds during the credit (interval -0.002 to 0.045), but the same weeks a year earlier, with no credit, show 0.029. Forecasting 8 February to 30 April 2025, the dynamic model is not more accurate than the static one (share error of 2.83 against 2.80 points). Riders adapt, but within days, and a five-week credit did not move them for good.
The drivers and the price policy. With slow drivers the three policies settle, and the market-clearing surge earns 4.6% more margin than a fixed price with a shorter wait. The surge, though, makes drivers’ relative pay move with the multiplier itself, which amplifies their reaction about 2.5 times. Cycles start at an imitation speed of 0.75 under the clearing surge, at 1.75 when it is smoothed to a tenth of the gap per day, and between 1 and 2 with a fixed price. When prices cycle, the margin can even rise, because short-run demand is inelastic, while waits grow and drivers crowd in and out of the same areas. A platform that looks only at the margin will not see the cost; riders and drivers will.
The experiment. With four-hour blocks the log margin of a block varies around its usual level with a standard deviation of 0.22, so two weeks detect a 15% change in margin, four weeks 10%, eight weeks 7%. Since drivers keep moving after a switch, the dynamics above argue for blocks long enough to let them settle.
Limits
Prices are what the platforms chose, so the price coefficients are associations given zone, day of week and wait, not causal elasticities; the causal part of the case is the credit, and there the effect is not distinguishable from the placebo. Credits and promotions do not appear in the fares, and Uber’s own promotions are unknown. Daily inertia may mix habits with persistent local shocks. The simulator assumes the observed split of drivers is a rest point, uses a published elasticity, and has no driver identifiers, so its speeds are scenarios, not estimates. In 2025 Uber started passing some requests to yellow cabs, which leave this data.
Applied to your pricing
This is the Custom Forecasting package applied to price. For a mobility or delivery platform, a car rental or fleet operator, a parking or events business, it becomes a pricing engine with three parts: a demand forecast by place and hour, a price response measured on your own data, and a policy tested in a simulator and then in a switchback before it goes live. The decision on prices stays with your people.
Paper and code
Version 2, 25 November 2026. The first version went live in a hurry; this one adds what it left out: a working paper, a pricing API with a Docker image and a model card, a monthly drift monitor and the zone map. The drift monitor compares the distribution of trip distance, minutes, fare per mile and wait each month with the end of 2024: every month through June 2025 has a population stability index below 0.05, so the data the model sees have not moved. No result of the first version changed.
Read the paper (PDF) github.com/rhozon/mobility-dynamic-pricing
With Python 3.11 or later:
pip install -e ".[dev]"
pytest -v
python -m mdp.cli download # monthly trip files (about 7 GB)
python -m mdp.cli aggregate # one DuckDB pass per month
python -m mdp.cli analyse # every table in results/
python -m mdp.cli drift # monthly drift report
docker build -t mdp-api . && docker run -p 8000:8000 mdp-api # POST /quote, POST /multiplierReferences
Data: NYC Taxi and Limousine Commission, trip record data; Lyft, terms of the NYC congestion fee credit.
- Bojinov, I., Simchi-Levi, D. and Zhao, J. (2023). Design and Analysis of Switchback Experiments. Management Science, 69(7), 3759-3777. doi:10.1287/mnsc.2022.4583
- Castillo, J. C., Knoepfle, D. and Weyl, G. (2017). Surge Pricing Solves the Wild Goose Chase. Proceedings of the 2017 ACM Conference on Economics and Computation, 241-242. doi:10.1145/3033274.3085098
- Cohen, P., Hahn, R., Hall, J., Levitt, S. and Metcalfe, R. (2016). Using Big Data to Estimate Consumer Surplus: The Case of Uber. NBER Working Paper 22627. doi:10.3386/w22627
- Diebold, F. X. and Mariano, R. S. (1995). Comparing Predictive Accuracy. Journal of Business & Economic Statistics, 13(3), 253-263. doi:10.1080/07350015.1995.10524599
- Fudenberg, D. and Levine, D. (1998). Learning in games. European Economic Review, 42(3-5), 631-639. doi:10.1016/s0014-2921(98)00011-7
- Garg, N. and Nazerzadeh, H. (2022). Driver Surge Pricing. Management Science, 68(5), 3219-3235. doi:10.1287/mnsc.2021.4058
- Hofbauer, J. and Sandholm, W. H. (2002). On the Global Convergence of Stochastic Fictitious Play. Econometrica, 70(6), 2265-2294. doi:10.1111/1468-0262.00376
- Sandholm, W. H. (2015). Population Games and Deterministic Evolutionary Dynamics. Handbook of Game Theory with Economic Applications, 703-778. doi:10.1016/b978-0-444-53766-9.00013-6