Tutorials › Survey Sampling › Weighted Percentiles and Interquartile Ranges

Weighted Descriptive Analysis · Tutorial 709 of 998

Weighted Percentiles and Interquartile Ranges

Use survey weights to estimate percentiles and the interquartile range, then interpret the spread and asymmetry of the middle half of a population distribution.

Intermediate 9 min read

What You'll Learn

  • Define a weighted percentile using the weighted empirical cumulative distribution function.
  • Calculate selected percentiles from ordered observations and cumulative weights.
  • Handle ties and percentile cutoffs that fall within a cumulative-weight jump.
  • Compute the weighted interquartile range and state its units.
  • Use quartile distances and Bowley’s coefficient to describe central asymmetry.
  • Distinguish a weighted descriptive estimate from a design-based uncertainty statement.

Why Weighted Percentiles Matter

A survey’s weighted mean and standard deviation summarize location and spread, but they can be sensitive to extreme observations. Percentiles provide another view: a percentile identifies a point in the outcome scale below which a specified share of the estimated population lies. The interquartile range (IQR), the distance between the 75th and 25th percentiles, summarizes the spread of the central half of that distribution.

In a survey, observations can represent different numbers of population members. A percentile calculated without weights describes the distribution of the observed sample records; a weighted percentile instead describes the estimated population distribution represented by those records and weights. This tutorial uses a precise inverse-cumulative-distribution convention, so the calculation is reproducible even when weights are unequal or outcomes are tied.

Weighted Percentiles

Definition: Let \(x_i\) be an observed outcome and \(w_i>0\) its survey weight for each eligible record \(i=1,\ldots,n\). The weighted empirical cumulative distribution function is $$ \widehat{F}_w(t)=\frac{\sum_{i=1}^{n}w_i I(x_i\leq t)}{\sum_{i=1}^{n}w_i}, $$ where \(I(x_i\leq t)\) equals 1 when \(x_i\leq t\) and 0 otherwise. For \(0<p<1\), the estimated \(p\) quantile is the generalized inverse $$ \widehat{Q}_w(p)=\inf\{t:\widehat{F}_w(t)\geq p\}. $$ The estimated \(100p\)th percentile is \(\widehat{Q}_w(p)\).

To calculate it, sort the records by outcome, add their weights cumulatively, and find the first outcome at which the cumulative weight reaches at least \(p\) of the total weight. Equivalently, if weights are normalized to sum to 1, find the first cumulative normalized weight at least \(p\). The cutoff is compared with the fraction of total weight, not with the fraction of records.

This inverse convention returns an observed outcome, rather than interpolating between adjacent values. Other quantile conventions may interpolate, so software and reports should identify the convention when exact agreement matters. With this convention, a tied outcome contributes its full weight at that outcome: the estimated CDF jumps by the combined weight of all records with that value. The cutoff may fall within a jump, but the estimated percentile remains the outcome where the jump occurs.

Worked Example: Finding Weighted Quartiles

Suppose a hypothetical survey has the following ordered household travel times. The weights are shown in population-representative units; all records are eligible and the weights are positive.

Travel time (minutes)WeightCumulative weight
1022
2013
3047
50310

The total weight is \(W=2+1+4+3=10\). For the 25th percentile, the target cumulative weight is \(0.25(10)=2.5\). The cumulative weight first reaches or exceeds 2.5 at 20 minutes, so \(\widehat{Q}_w(0.25)=20\) minutes. For the median, the target is \(0.50(10)=5\); the cumulative weight first reaches 5 at 30 minutes, so \(\widehat{Q}_w(0.50)=30\) minutes. For the 75th percentile, the target is \(0.75(10)=7.5\), first reached at 50 minutes. Thus \(\widehat{Q}_w(0.75)=50\) minutes.

The record at 30 minutes accounts for four weight units, so the cumulative weight moves from 3 to 7 there. A target of 5 falls inside that jump; under the stated generalized-inverse convention, the percentile is 30 minutes, not an interpolated value.

Interquartile Range and Central Asymmetry

Definition: The estimated first quartile is \(\widehat{Q}_1=\widehat{Q}_w(0.25)\), the estimated median is \(\widehat{Q}_2=\widehat{Q}_w(0.50)\), and the estimated third quartile is \(\widehat{Q}_3=\widehat{Q}_w(0.75)\). The weighted interquartile range is $$ \widehat{\mathrm{IQR}}_w=\widehat{Q}_3-\widehat{Q}_1. $$ It measures the width of the interval between the estimated 25th and 75th percentiles, in the same units as the outcome.

The IQR describes the spread of the estimated distribution’s middle half. It does not say that exactly half of the weighted records lie strictly between the quartiles: ties at either quartile can place weight on the boundary, and the estimated CDF can jump over the percentile cutoff. The IQR is nonnegative because the quantile definition orders the quartiles, so \(\widehat{Q}_1\leq\widehat{Q}_3\).

Quartiles can also describe whether the middle half is balanced around the median. Compare the distance above the median, \(\widehat{Q}_3-\widehat{Q}_2\), with the distance below it, \(\widehat{Q}_2-\widehat{Q}_1\). A longer upper distance indicates that the upper half of the central interval is more spread out; a longer lower distance indicates more spread below the median. A standardized summary of this comparison is Bowley’s quartile coefficient of skewness:

$$ \widehat{B}_w= \frac{(\widehat{Q}_3-\widehat{Q}_2)-(\widehat{Q}_2-\widehat{Q}_1)} {\widehat{Q}_3-\widehat{Q}_1} = \frac{\widehat{Q}_3+\widehat{Q}_1-2\widehat{Q}_2} {\widehat{Q}_3-\widehat{Q}_1}, \qquad \widehat{Q}_3>\widehat{Q}_1. $$

When the IQR is positive, \(\widehat{B}_w\) lies between \(-1\) and 1. A positive value indicates a longer upper quartile distance from the median; a negative value indicates a longer lower distance. A value near zero says the two distances are similar, not that the entire distribution is symmetric. This is a descriptive measure of the central half only; it does not characterize the tails or establish a population shape by itself.

Worked Example: Calculating IQR and Quartile Asymmetry

Consider hypothetical ordered survey outcomes of 2, 4, 6, 10, and 18 units, with respective weights 1, 2, 3, 2, and 2. Assume all five records are eligible and the listed weights are appropriate for the population being described. Total weight is \(W=1+2+3+2+2=10\).

The cumulative weights are 1, 3, 6, 8, and 10. The 25th-percentile target is \(0.25(10)=2.5\), first reached at outcome 4, so \(\widehat{Q}_1=4\) units. The median target is \(0.50(10)=5\), first reached at outcome 6, so \(\widehat{Q}_2=6\) units. The 75th-percentile target is \(0.75(10)=7.5\), first reached at outcome 10, so \(\widehat{Q}_3=10\) units.

The IQR is $$ \widehat{\mathrm{IQR}}_w=\widehat{Q}_3-\widehat{Q}_1=10-4=6\text{ units}. $$ The middle half therefore spans 6 units, from 4 to 10 units. The distance above the median is \(10-6=4\) units, while the distance below is \(6-4=2\) units. Bowley’s coefficient is $$ \widehat{B}_w=\frac{4-2}{6}=\frac{1}{3}\approx 0.333. $$ This positive value indicates that the upper quartile distance is longer than the lower one in this hypothetical weighted distribution. It is evidence of asymmetry in the central half as summarized by these quartiles; it is not a claim about the shape of every part of the distribution.

A Short Justification of the Cumulative-Weight Rule

The calculation rule follows directly from the definition. After sorting the observed values, let \(x_{(1)}\leq\cdots\leq x_{(n)}\) denote the ordered outcomes, with their corresponding weights \(w_{(i)}\). At an observed value \(x_{(j)}\), the estimated CDF includes the weights of all observations at or below that value. If values are distinct, this is the cumulative weight through position \(j\), divided by total weight. Therefore,

$$ \widehat{F}_w(x_{(j)})= \frac{\sum_{i=1}^{j}w_{(i)}}{\sum_{i=1}^{n}w_{(i)}}. $$

The generalized inverse selects the first \(x_{(j)}\) for which this ratio is at least \(p\). Multiplying both sides of the cutoff condition by the positive total weight gives

$$ \widehat{F}_w(x_{(j)})\geq p \quad\Longleftrightarrow\quad \sum_{i=1}^{j}w_{(i)}\geq p\sum_{i=1}^{n}w_{(i)}. $$

That inequality is exactly the cumulative-weight rule. If several records share \(x_{(j)}\), their weights are all included at that value; grouping tied records or retaining their separate rows gives the same CDF jump and percentile.

Worked Example: Unequal Weights Change a Percentile

In a hypothetical survey, five ordered participants report weekly exercise hours of 1, 2, 3, 4, and 8, with weights 1, 1, 6, 1, and 1. The total weight is 10, and all weights are positive. The weighted median target is \(0.50(10)=5\). Cumulative weights are 1, 2, 8, 9, and 10, so the first cumulative weight of at least 5 occurs at 3 hours. Thus the estimated weighted median is 3 hours.

Without weights, there are five records and the middle ordered observation is also 3 hours. In this case the unweighted and weighted medians happen to agree, but the weighted result is supported by six of the ten total weight units at 3 hours. For the 75th percentile, the weighted target is \(0.75(10)=7.5\), which is first reached at 3 hours, so \(\widehat{Q}_w(0.75)=3\) hours. The unweighted inverse-ECDF 75th percentile is 4 hours, because the fourth of five records is the first to reach 75% of the records. The difference arises because the six-weight-unit record at 3 hours represents a large share of the estimated population.

Interpretation, Scope, and Common Pitfalls

A weighted percentile is a point estimate based on the observed outcomes and their survey weights. It is meaningful for the intended population only when the records included, the outcome values, and the weights are appropriate for that target. Before calculating, specify the analytic domain and denominator: records missing the outcome or outside the target group should not silently be treated as valid observations with zero values. The total in the weighted empirical distribution is the sum of weights for the eligible records used in that calculation.

The IQR and quartile asymmetry coefficient are descriptive summaries, not measures of sampling uncertainty. Their numerical values alone do not provide a standard error, confidence interval, or test of a population hypothesis. In complex surveys, uncertainty requires methods that account for the sampling design; the weighted point estimate should not be mistaken for a guarantee that the corresponding population percentile is known exactly.

  • Using record counts as the cutoff. The wrong reasoning is, “The 75th percentile is at the fourth of five records, regardless of weights.” The correction is to locate 75% of the total eligible weight, which can occur at a different ordered value.
  • Interpolating without stating a convention. The wrong reasoning is to assume every percentile must lie between two observed values. Under the generalized-inverse convention used here, the estimate is the first observed value whose weighted CDF reaches the target; interpolation is a different convention.
  • Calling the IQR a full measure of distribution shape. The IQR describes central spread, and Bowley’s coefficient compares the two central quartile distances. Neither captures all tail behavior or proves overall symmetry.
  • Reporting a number without context. State the outcome, the population or domain, the percentile convention when relevant, and the units. For example, “the estimated weighted IQR of weekly exercise time is 6 hours” is more informative than “the IQR is 6.”

These summaries are useful when a population’s typical range and central balance matter more than its mean alone. The IQR is resistant to a small number of extreme values, while the quartile distances show whether the upper or lower side of the middle half extends farther from the median. Interpreting them alongside other summaries gives a compact, weight-aware account of distributional spread without implying more detail than three quartiles can support.

Check Your Understanding

Use the generalized-inverse convention in your answers.

  1. In your own words, explain why a weighted percentile cutoff is based on a fraction of total weight rather than a fraction of the number of records.
  2. Ordered values are 5, 7, and 9 with weights 2, 5, and 3. What is the estimated 50th percentile? Show the total weight, target, and cumulative-weight step.
  3. If \(\widehat{Q}_1=12\) minutes and \(\widehat{Q}_3=27\) minutes, calculate the IQR and state its units and interpretation.
  4. If \(\widehat{Q}_1=4\), \(\widehat{Q}_2=6\), and \(\widehat{Q}_3=10\), calculate Bowley’s coefficient and describe what its sign indicates.
  5. Why does a weighted IQR not by itself provide a confidence interval or establish the shape of the full population distribution?
Clinical Biostats