Bootstrap it. Resample your data with replacement up to the original size, compute the median on each resample, repeat a few thousand times, then take the 2.5th and 97.5th percentiles of that distribution as a 95 percent interval. It needs no distributional assumption and works for medians, ratios, and other awkward statistics, provided the observations you resample are independent.
Why interviewers ask this
This checks whether you can go past the formulas you memorized when the statistic does not have one. The interviewer is listening for resampling with replacement at the same size, a sensible number of iterations, and awareness of the independence assumption, since bootstrapping rows when one user contributes hundreds of sessions produces intervals that are far too narrow to be useful.
How to structure your answer
- Describe the resampling loop concretely in two sentences.
- Say how the interval falls out of the percentile spread.
- Name the assumption it does need: independent observations.
- Mention clustered or block bootstrapping when rows are grouped.
Example answer
I bootstrap. Sample the observations with replacement up to the original sample size, compute the median on that resample, store it, and repeat a few thousand times. The spread of those medians is an empirical sampling distribution, and I take the 2.5th and 97.5th percentiles as the interval. It is easy to implement and it works for statistics that have no nice formula, which is most of the interesting ones: medians, 90th percentiles, ratios of two metrics, differences of medians between groups. The assumption that actually bites is independence. If I am bootstrapping session length and one heavy user has four hundred sessions, resampling individual sessions treats those as four hundred independent facts and the interval comes out far too narrow. So I resample users, not sessions, and take all of that user's sessions along with them. Same idea for time series, where I block bootstrap contiguous chunks to keep the autocorrelation intact. Get the unit of resampling wrong and you get a confident, tight, completely wrong interval.
Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.
See how it worksFollow-up questions to expect
- How many bootstrap iterations do you run, and how do you decide?
- When does the bootstrap fail outright?
- What is the difference between the percentile and the bias corrected interval?
Related data scientist questions
Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.
Predict my questions