KatInterview

Switchback Test Design for Reducing Cold Deliveries by Bike

Statistics & ExperimentsModel answer
HardModel answerStatistics & Experimentsswitchbackexperiment-designcluster-robust-se

Last updated

Design and analyze a two-week, city-level switchback test of a courier feature: slot length, randomization, ITT versus exposure, clustered regression, power, diagnostics and stopping rules.

A food-delivery marketplace has built a feature meant to cut the share of orders that reach customers cold when delivered by bike couriers in dense urban zones. Because couriers and demand are shared across orders, you can't randomize individual orders. Instead you will run a two-week switchback test: within each city, the feature alternates ON and OFF across equal-length time slots.

Facts you can use: an order takes about 45 minutes from dispatch to delivery, and courier positioning from the previous slot carries over for about 30 minutes.

Answer each part precisely.

A. Randomization. Pick a slot length L and justify it against the contamination sources above. Describe a block-randomization scheme that balances day-of-week and peak hours while keeping the schedule unpredictable.

B. Assignment vs. exposure. Distinguish slot-level assignment (intention-to-treat) from realized exposure, for example when OFF-slot couriers pick up spillover demand from nearby ON slots. State the numerator and denominator of the primary metric (cold-food rate among bike deliveries). Show two denominator variants: (1) all deliveries, condition_label in {0, 1}; (2) only deliveries with condition_label = 1.

C. Analysis model. Write the exact regression, with city fixed effects, slot-of-week fixed effects and standard errors clustered at city×slot. Explain how pre-period baselines and covariates (weather, surge, courier mix) could add precision, and what risks they carry.

D. Power. Baseline cold-food rate is 6%, the target is a 10% relative reduction (0.6 percentage points), there are 120 eligible orders per slot on average, slot-level ICC is 0.02, and the test lasts 14 days. Estimate how many slots, cities and ON↔OFF switchbacks you need for 80% power at α = 0.05. State assumptions and show the calculation or code.

E. Diagnostics. List concrete randomization and balance checks, and describe how you would test for carryover (leading indicators, excluding boundary periods, and so on).

F. Robustness. Explain how you would handle partial compliance, missing telemetry and mid-test shocks such as a major event. Give a principled rule for when to stop, extend or rerun.

Hints

Hint 1

Slot length must exceed the order lifecycle plus the courier carryover horizon, but each extra hour you add shrinks the number of clusters, and clusters are where your power comes from.

Hint 2

For the power calculation, first compute the order count for a plain two-proportion test, then multiply by the design effect 1 + (m − 1)ρ and divide by orders per slot to get slots. Convert slots to cities using the number of slots one city offers in 14 days.

Hint 3

Keep the randomized assignment as the primary analysis (ITT). Treat anything that conditions on realized exposure or on post-assignment covariates as secondary, because both can reintroduce bias. Pre-register the decision rules before looking at outcomes.