Why Ties and Discrete Outcomes Need Care
A weighted quantile is located by accumulating survey weight across ordered outcome values. With continuous measurements and many distinct values, the cumulative distribution may appear to rise gradually. With a discrete outcome, such as number of visits, or whenever several sampled units share the same value, the weighted empirical distribution instead has jumps. A requested probability level can fall inside one of those jumps: there may be no observed outcome whose cumulative weight corresponds exactly to that probability.
This is not a calculation failure. It reflects the distribution’s support and the quantile convention being used. The key is to state that convention, combine all weights attached to tied values, and report the observed value at which cumulative weight first reaches or exceeds the requested level. This tutorial uses the inverse-ECDF convention throughout.
The weights in this definition are assumed to be nonnegative, and the denominator must be positive. In ordinary survey applications, the analysis weights are positive for included records. A zero-weight record contributes nothing and can be omitted from the calculation. Negative weights do not define a cumulative distribution by this formula, because cumulative proportions need not be nondecreasing.
The \(q\) in this definition is a proportion, not a percentage: for example, the 70th percentile uses \(q=0.70\). The result is expressed in the original units of the outcome. For a count of visits it is a number of visits; for a waiting time measured in minutes it is a number of minutes.
Consolidate Ties, Then Accumulate Weight
When outcomes are tied, all survey weight attached to that value contributes at once to the cumulative distribution. It is useful to first list the distinct observed outcome values in increasing order. For each value, add the weights of all records with that outcome. Then form cumulative weight and divide by \(W\). Do not count tied records as though their outcomes occurred at different positions within the tie: the empirical distribution only changes at the tied value.
Worked Example: A Median With a Tie at the Crossing Value
Consider a hypothetical weighted sample of six households. The outcome is the number of clinic visits in the past year. The table lists the outcome and survey weight for each household.
| Household | Visits | Weight |
|---|---|---|
| A | 0 | 2 |
| B | 1 | 3 |
| C | 1 | 1 |
| D | 2 | 2 |
| E | 2 | 4 |
| F | 4 | 2 |
The total weight is \(W=2+3+1+2+4+2=14\). Consolidating the tied outcomes gives weight 2 at 0 visits, weight \(3+1=4\) at 1 visit, weight \(2+4=6\) at 2 visits, and weight 2 at 4 visits. The cumulative proportions are therefore:
| Visits \(y\) | Weight at \(y\) | Cumulative weight | Weighted cumulative proportion |
|---|---|---|---|
| 0 | 2 | 2 | 2/14 = 0.1429 |
| 1 | 4 | 6 | 6/14 = 0.4286 |
| 2 | 6 | 12 | 12/14 = 0.8571 |
| 4 | 2 | 14 | 14/14 = 1.000 |
For the median, \(q=0.50\). The cumulative proportion at 1 visit is 0.4286, which is below 0.50; at 2 visits it is 0.8571, which reaches and exceeds 0.50. Thus \(\widehat{Q}_w(0.50)=2\) visits. The tie at 2 visits matters because both households’ weights are included together: the cumulative proportion jumps from 0.4286 to 0.8571 at that outcome.
When the Cumulative Proportion Jumps Over the Target
For a discrete outcome, it is common that the cumulative proportion at the selected value is greater than \(q\), rather than exactly equal to \(q\). Under the inverse-ECDF convention, the requirement is “at least \(q\),” not “equal to \(q\).” The reported quantile is the first observed value at which that requirement holds. The proportion can overshoot because all weight at a particular value enters the cumulative total at once.
This convention is particularly natural when the outcome can take only specified values, such as a number of children or a rating on a five-point scale. Interpolating between two possible outcomes could produce a value that is not in the outcome’s support. For example, a quantile of 2.4 hospital admissions would not be an attainable count for an individual. Interpolation is used by some software and descriptive conventions for certain quantile calculations, but it is a different rule and must not be silently substituted for the inverse-ECDF definition.
Worked Example: The Target Falls Inside a Jump
Suppose a hypothetical survey records the number of missed workdays among sampled employees. After combining tied outcomes, the total weight is \(W=20\), with weighted counts of 3 at 0 days, 5 at 1 day, 8 at 2 days, and 4 at 3 days. Find the weighted 60th percentile using the inverse-ECDF convention.
The target cumulative weight is $$ qW=0.60(20)=12. $$
The cumulative weights at 0, 1, 2, and 3 days are respectively 3, 8, 16, and 20. Equivalently, the cumulative proportions are 0.15, 0.40, 0.80, and 1.00. At 1 day the cumulative proportion remains below 0.60, while at 2 days it reaches 0.80, so $$ \widehat{Q}_w(0.60)=2\text{ days}. $$
No observed outcome has cumulative proportion exactly 0.60: the weighted distribution jumps from 0.40 to 0.80. The quantile is nevertheless well-defined. Its interpretation is that 2 days is the smallest observed number of missed workdays for which at least 60% of the total survey weight is on outcomes at or below that value. It does not mean that exactly 60% of the weight is at or below 2 days.
A Short Justification of the Locating Rule
Let the distinct observed outcomes be \(z_1<z_2<\cdots<z_m\), and let \(a_j\) be the sum of the survey weights for records with outcome \(z_j\). Then \(a_j\geq0\), and \(\sum_{j=1}^{m}a_j=W\). Define the cumulative weight through \(z_j\) as \(C_j=\sum_{k=1}^{j}a_k\). The weighted empirical distribution is constant between successive observed outcomes and, at \(z_j\), has value \(C_j/W\). Therefore the first outcome where it reaches \(q\) is exactly the first \(z_j\) for which \(C_j/W\geq q\).
By minimality of \(j\), the preceding cumulative proportion is below \(q\) when \(j>1\), while the proportion at \(z_j\) is at least \(q\):
This inequality makes the jump explicit. If the left and right bounds differ, \(q\) lies within the probability mass accumulated at \(z_j\), and no requirement exists that a value have cumulative proportion exactly \(q\). If the cumulative proportion happens to equal \(q\) at an observed value, that value is still the first to reach the target, and the same locating rule applies.
Worked Example: A High Quantile With Several Tied Outcomes
A hypothetical survey asks respondents to rate a service from 1 to 5, with 5 the most favorable rating. The combined survey weights at the observed ratings are 4 at rating 1, 6 at rating 2, 10 at rating 3, 6 at rating 4, and 4 at rating 5. Find the 75th percentile under the inverse-ECDF convention.
The total weight is \(W=4+6+10+6+4=30\), so the target weight is \(0.75(30)=22.5\). The cumulative weights in rating order are 4, 10, 20, 26, and 30; the corresponding cumulative proportions are 0.1333, 0.3333, 0.6667, 0.8667, and 1.000.
The cumulative weight at rating 3 is 20, which is less than 22.5. At rating 4 it is 26, which is at least 22.5. Hence $$ \widehat{Q}_w(0.75)=4. $$
The 75th percentile is a rating of 4 on the five-point scale. It does not claim that exactly 75% of the weighted responses have ratings of 4 or less: in this example, that proportion is \(26/30=0.8667\), or about 86.7%. The weighted cumulative proportion below rating 4 is \(20/30=0.6667\), or about 66.7%. The target lies within the jump at rating 4.
Interpretation and Common Pitfalls
A weighted empirical quantile is a descriptive estimate based on the weighted sample distribution. It identifies a threshold in the outcome’s units. Under the stated inverse-ECDF convention, at least a fraction \(q\) of total sample weight lies at or below the reported value, and the cumulative proportion immediately before that value is below \(q\), provided the value is not the minimum observed outcome. This is a statement about the weighted empirical distribution, not a confidence interval or a guarantee that the same threshold is the population quantile. Sampling uncertainty is a separate question.
Tied values are not a reason to split weights arbitrarily across records in order to force an exact target. The order within a tie has no meaning for the outcome distribution: every record in the tie has the same value, so all of their weights enter at that value. Likewise, an outcome need not be present at every numerical point. A discrete distribution can only place cumulative jumps at its observed support values.
- Pitfall: demanding exact equality. Wrong reasoning: “The target is 60%, but the cumulative proportions are 40% and 80%, so the quantile cannot be found.” Correction: choose the smallest observed value whose cumulative proportion is at least 60%; here it is the value where the distribution jumps to 80%.
- Pitfall: splitting tied weights by row order. Wrong reasoning: “I can put some of the tied records before the target and the rest after it.” Correction: aggregate the weights at that outcome, because a weighted empirical distribution changes at the value, not at an arbitrary row position.
- Pitfall: reporting an interpolated impossible outcome without naming the rule. Wrong reasoning: “The 60th percentile must be between the two outcomes around 60%, so I will average them.” Correction: use the stated convention. Under the inverse-ECDF convention the result is an observed support value; interpolation is a distinct convention and can yield a value that is unattainable for a discrete outcome.
A clear report gives the probability level, the convention, the estimated value and its units, and—when the distribution jumps over the target—the cumulative proportions on either side of the selected value. That information makes the result interpretable and prevents a reader from mistaking an overshoot for a computational error.
Check Your Understanding
Use the inverse-ECDF convention in each question.
- Why should weights for records tied at the same outcome be combined before locating a weighted quantile?
- A weighted distribution has cumulative proportions 0.18 at 0 events, 0.47 at 1 event, and 0.79 at 2 events. What is the weighted 50th percentile, and why need it not have cumulative proportion exactly 0.50?
- State the inequality relating \(q\), the cumulative proportion immediately before the selected value, and the cumulative proportion at that value.
- A report gives a weighted 80th percentile of 3.6 visits even though visits are recorded as whole numbers. What question should you ask about the quantile convention used?
- What is the difference between saying that at least 75% of the total survey weight is at or below a reported quantile and saying that exactly 75% is at or below it?