Calculator
Example data table
| # | Observation | Comment |
|---|---|---|
| 1 | 12 | Lower tail value |
| 2 | 14 | Typical early observation |
| 3 | 18 | Near center region |
| 4 | 21 | Near center region |
| 5 | 22 | Median neighborhood |
| 6 | 25 | Repeated value (ties) |
| 7 | 25 | Repeated value (ties) |
| 8 | 27 | Upper-middle observation |
| 9 | 29 | Upper-middle observation |
| 10 | 31 | Upper tail value |
Formula used
For the order-statistic interval, sort the sample as x(1) ≤ x(2) ≤ … ≤ x(n). A distribution-free confidence interval for the population median uses the sign-test logic:
- Choose an integer k so that coverage is at least the requested confidence: Coverage = 1 − 2·P(Bin(n, 0.5) ≤ k−1).
- The confidence interval is then [ x(k+1), x(n−k) ].
The calculator finds the smallest k meeting the target coverage (exact method), or estimates k using a normal approximation for large samples. The bootstrap option reports percentile bounds from resampled medians.
How to use this calculator
- Paste your sample values into the data box. Add frequencies using value:count.
- Select a confidence level and a method. Use Exact for strict distribution-free coverage.
- Click Calculate to display the interval above the form.
- Enable step-by-step to see how k and the bounds are chosen.
- Use Download CSV or Download PDF to export the latest results.
Median interval guidance
Why median intervals matter
The median is a robust location measure that changes slowly when a few extreme values enter the sample. A confidence interval adds uncertainty, turning a single point estimate into a range of plausible population medians. In wait times, medical biomarkers, and skewed revenue data, median intervals often provide a clearer “typical outcome” story than mean-based summaries.
Exact order-statistic coverage
The exact option is distribution-free and is built from order statistics. Sort the sample x(1) ≤ … ≤ x(n). Choose an integer k so the central region has at least the requested confidence: Coverage = 1 − 2·P(Bin(n,0.5) ≤ k−1). The interval is [x(k+1), x(n−k)]. Because it is based on signs relative to the true median, it remains valid under heavy tails and skew.
Interpreting k, L, and U
k controls how many observations are trimmed from each tail before forming the interval. The lower rank is L = k+1 and the upper rank is U = n−k. Higher confidence increases k and widens the interval, while larger n typically shrinks it. When n is small, k may be 0, giving [x(1), x(n)]—wide, but honest about limited information.
Bootstrap percentile insights
Bootstrap percentile intervals resample the observed data with replacement B times, compute a median for each resample, and then take the α/2 and 1−α/2 quantiles of those medians. This approach can reflect skewness, and it is easy to explain. However, coverage is approximate, depends on B and random variation, and can be sensitive when the sample is highly clustered.
Handling ties and small samples
Rounded measurements, rating scales, and repeated values produce ties. Rank-based order-statistic intervals naturally accommodate ties because they select endpoints by position, not by unique values. Bootstrap medians will also repeat, which can make percentile jumps visible. If endpoints look “sticky,” that is a data-resolution signal. Collecting more observations or higher-resolution measurements improves interpretability.
Reporting results and exports
For professional reporting, include the method, confidence level, n, the sample median, and the interval endpoints. If you compare methods, state the target: order-statistic intervals provide guaranteed coverage for the population median, while bootstrap intervals describe sampling variability of the sample median. Exported CSV and PDF summaries support audit trails, peer review, and consistent reuse.
FAQs
1) What does a median confidence interval mean?
It is a range of values that should contain the population median with the chosen confidence, under repeated sampling of the same size from the same process.
2) Why can the “exact” interval be wide?
Exact coverage is guaranteed without distribution assumptions, so small samples require more conservative bounds. As n increases, the order-statistic ranks tighten and the interval typically narrows.
3) What should I pick: exact, normal, or bootstrap?
Use exact for strict distribution-free reporting, normal-k for quick large-n approximations, and bootstrap when you want an intuitive, data-driven uncertainty view and can tolerate approximate coverage.
4) How are ties handled?
Ties are fine. Order-statistic bounds pick ranked positions, so endpoints may repeat. Bootstrap medians can also repeat, which reflects discrete or rounded measurement scales.
5) How many bootstrap resamples (B) do I need?
Common choices are 1,000 to 10,000. Larger B stabilizes percentile cutoffs but costs time. If results change noticeably with B, your sample is likely small or highly tied.
6) Does the interval estimate the sample median or population median?
Exact and normal order-statistic methods target the population median. Bootstrap percentiles approximate the sampling variability of the sample median and often behave similarly, but do not guarantee exact coverage.