Tutorials › Survey Sampling › Weighted Histograms and Distribution Plots

Weighted Descriptive Analysis · Tutorial 710 of 998

Weighted Histograms and Distribution Plots

See how survey weights determine histogram heights and cumulative values, and how bin widths and plot scales affect their population interpretation.

Intermediate 10 min read

What You'll Learn

  • Define weighted histogram heights on normalized-share and weighted-total scales.
  • Interpret bar areas for equal-width and unequal-width bins.
  • Choose and report bin boundaries, widths, and axis units clearly.
  • Construct a right-continuous weighted cumulative distribution plot, including at tied values.
  • Distinguish descriptive population representation from sampling uncertainty.

Why Weights Change a Distribution Plot

A histogram describes how observations are distributed across ranges of a quantitative variable. In a survey, however, one sampled respondent may represent many people, while another represents fewer. An unweighted histogram gives each respondent equal influence; a weighted histogram gives each record influence in proportion to its survey weight. The resulting bars describe the distribution represented by the weights, not simply the distribution of the records in the sample.

The vertical scale matters. A bar can show a weighted share per unit of the variable, so its area is the share represented in that bin. Alternatively, a bar can show weighted population total per unit, so its area is the weighted total in that bin. In both cases, the bin width is part of the interpretation. A taller bar does not necessarily represent more people when its bin is narrower.

Definition: Suppose the analytic survey records have measured values \(x_1,\ldots,x_n\) and nonnegative survey weights \(w_1,\ldots,w_n\). Let \(W=\sum_{i=1}^{n}w_i\), and assume \(0<W<\infty\). For a bin \(B_j\), its weighted total is \(T_j=\sum_{i=1}^{n}w_i I(x_i\in B_j)\), where \(I(\cdot)\) equals 1 when the condition is true and 0 otherwise. Its weighted share is \(P_j=T_j/W\). If the bin has width \(\Delta_j\), the normalized weighted histogram height is \(h_j=P_j/\Delta_j\). Thus the bar’s area is \(h_j\Delta_j=P_j\). A weighted-total histogram instead uses height \(T_j/\Delta_j\), so its bar area is \(T_j\).

For ordinary histogram displays, bins are nonoverlapping intervals that cover the plotted range. A consistent boundary convention is needed so that each observation belongs to exactly one bin. For example, use bins closed at the left and open at the right, with the final bin also including its right endpoint. Observations outside the plotted range must either be shown in additional bins or explicitly excluded from the displayed distribution.

A normalized histogram uses vertical units of share per unit of the measured variable. If the variable is age in years, the height is share per year; if it is income in dollars, the height is share per dollar. The normalized bar areas over all bins sum to 1, provided the bins include every record with positive weight. On the weighted-total scale, the vertical units are represented population units per unit of the variable, and the bar areas sum to \(W\). These scales answer related but different questions, so the axis label should make the choice clear.

Worked Example: Equal-Width Bins on a Share Scale

Worked Example: Equal-Width Bins on a Share Scale

Consider hypothetical survey records measuring weekly hours of exercise. The weights are treated as nonnegative representation weights, all five values fall within the plotted range, and their total is positive. Use bins from 0 to 30 hours with boundaries at 0, 10, 20, and 30.

RecordHours \(x_i\)Weight \(w_i\)
A44
B81
C122
D185
E253

The total weight is \(W=4+1+2+5+3=15\). The bin intervals are \([0,10)\), \([10,20)\), and \([20,30]\), each 10 hours wide. Their weighted totals are \(T_1=4+1=5\), \(T_2=2+5=7\), and \(T_3=3\). The corresponding shares are \(5/15=1/3\), \(7/15\), and \(3/15=1/5\).

Divide each share by the width, 10 hours, to obtain heights:

$$ h_1=\frac{1/3}{10}=\frac{1}{30}\approx0.03333,\qquad h_2=\frac{7/15}{10}=\frac{7}{150}\approx0.04667,\qquad h_3=\frac{1/5}{10}=\frac{1}{50}=0.02000. $$

The vertical axis is weighted share per hour. The respective bar areas are \((1/30)\cdot10=1/3\), \((7/150)\cdot10=7/15\), and \((1/50)\cdot10=1/5\). These areas sum to \(1/3+7/15+1/5=5/15+7/15+3/15=1\). The middle interval has the largest represented share, and it also has the tallest bar here because all widths are equal. These heights are descriptive summaries of the weighted records; they do not by themselves show sampling uncertainty.

Choosing Bin Widths and Reading Areas

Bin boundaries should be chosen to suit the variable’s units, its range, and the comparisons the plot is intended to support. Bins that are too wide can hide meaningful variation; bins that are too narrow can produce a visually irregular display that emphasizes small sample details. The boundaries and widths should be stated or be recoverable from the axis. For comparisons across groups, using the same boundaries and vertical scale is usually important: otherwise, apparent differences can be caused by different plotting choices.

Equal-width bins make it easier to compare heights, because a larger height also means a larger bin share. With unequal widths, compare areas to compare shares. A wide bin can have a larger share but a lower density height than a narrow bin. Drawing bar heights equal to the shares without accounting for width would make the area misleading when widths differ.

Worked Example: Unequal-Width Bins

Suppose a hypothetical survey records daily travel distance in kilometres. The six records have values and weights \((2,2),(4,1),(8,3),(12,2),(20,4),(27,3)\), where each pair is \((x_i,w_i)\). Assume these weights are nonnegative and that the listed records comprise the plotted range. Use bins \([0,5)\), \([5,15)\), and \([15,30]\), with widths 5, 10, and 15 kilometres.

The total weight is \(W=2+1+3+2+4+3=15\). The weighted totals by bin are \(T_1=2+1=3\), \(T_2=3+2=5\), and \(T_3=4+3=7\). Thus the bin shares are \(3/15=0.2000\), \(5/15=1/3\), and \(7/15\approx0.4667\). The normalized histogram heights are:

$$ h_1=\frac{3/15}{5}=\frac{1}{25}=0.04000,\qquad h_2=\frac{5/15}{10}=\frac{1}{30}\approx0.03333,\qquad h_3=\frac{7/15}{15}=\frac{7}{225}\approx0.03111. $$

The first bar is tallest, but its area is only \(0.2000\), less than the other bin shares. The areas are \(0.04000\cdot5=0.2000\), \((1/30)\cdot10=1/3\), and \((7/225)\cdot15=7/15\). They sum to \(3/15+5/15+7/15=1\). Therefore, the final, widest bin represents the largest weighted share even though it has the shortest bar. The exact share comes from the unrounded height; using a displayed rounded height can produce a small arithmetic discrepancy.

For the weighted-total version of this same plot, divide each bin total by its width instead. The heights would be \(3/5=0.6000\), \(5/10=0.5000\), and \(7/15\approx0.4667\) represented population units per kilometre. Multiplying each height by its width recovers the weighted totals 3, 5, and 7. This scale is useful when the aim is to show represented counts rather than proportions. Do not label it as a probability density: its areas add to \(W\), not 1.

Weighted Cumulative Distribution Plots

A cumulative plot avoids binning each observation into a displayed interval. It accumulates weighted share up to each possible value. For a quantitative variable \(X\), the weighted empirical cumulative distribution function (weighted ECDF) is the sum of weights attached to observed values at or below \(x\), divided by the total weight. It is a nondecreasing, right-continuous step function. Its vertical scale is a proportion from 0 to 1; multiplying its values by \(W\) instead gives cumulative weighted totals.

Definition: Given nonnegative weights with \(0<W<\infty\), the weighted empirical cumulative distribution function is
$$ \widehat{F}_w(x)=\frac{\sum_{i=1}^{n}w_i I(x_i\leq x)}{W}. $$
At a plotted value \(x\), \(\widehat{F}_w(x)\) is the weighted share of records whose measured value is at most \(x\). At any finite \(x\) below all observed values it is 0, and at or above the largest observed value it is 1, provided all positive-weight records are included.

To draw the plot, order the distinct observed values and add the weights at tied values before calculating the cumulative height. The curve stays flat between observed values and jumps at an observed value by the total weight at that value divided by \(W\). The right-continuous convention means that the jump is included at the value itself: the plotted height at \(x\) counts records with \(x_i\leq x\), not only those with \(x_i<x\).

Worked Example: A Cumulative Plot With Tied Values

A hypothetical survey records a symptom score for five respondents: scores and weights are \((1,2),(2,3),(2,1),(4,4),(7,2)\). Assume all weights are nonnegative, all records are included, and \(W>0\). The total weight is \(W=2+3+1+4+2=12\). The tied score of 2 has combined weight \(3+1=4\).

At score 1, the cumulative weighted total is 2, so \(\widehat{F}_w(1)=2/12=1/6\approx0.1667\). At score 2, it is \(2+3+1=6\), giving \(\widehat{F}_w(2)=6/12=0.5000\). At score 4, it is \(6+4=10\), giving \(\widehat{F}_w(4)=10/12=5/6\approx0.8333\). At score 7 it is 12, so \(\widehat{F}_w(7)=1.000\).

The plotted steps are therefore 0 below 1, \(1/6\) from 1 up to but not including 2, \(1/2\) from 2 up to but not including 4, \(5/6\) from 4 up to but not including 7, and 1 from 7 onward. For example, the height at a score of 4 is \(5/6\): the weighted share with score at most 4 is about 83.33%. The two respondents tied at score 2 contribute a single jump of \(4/12=1/3\), not two separately ordered jumps.

Why the Plots Matter, and What They Do Not Show

A weighted histogram provides a compact view of where represented population mass is concentrated across ranges. A weighted cumulative plot makes the ordering of that mass explicit and retains the observed values rather than grouping them into bins. Used together, they can reveal broad shape, concentration, gaps, and changes in cumulative share. Their interpretations remain tied to the survey weights and the population those weights are intended to represent; a weighted plot is not automatically a guarantee that every feature of the target population is captured without error.

These are descriptive plots. The weights affect the displayed distribution, but a histogram or cumulative curve alone does not display the sampling variability associated with a complex survey design. A smooth-looking curve is not evidence of high precision, and a jagged histogram is not a formal test of population differences. Design-based uncertainty requires additional methods.

1
Check the records and weights.
Define the analytic records and measurement, use nonnegative weights, and verify that the total weight is finite and positive.
2
Choose and document the display.
State bin boundaries and widths for a histogram; label whether heights are weighted shares or weighted totals per unit.
3
Read the appropriate quantity.
For a normalized histogram, interpret bar areas as weighted shares. For a cumulative plot, interpret the height at \(x\) as weighted share at or below \(x\).

A frequent mistake is to use weighted shares as the heights of unequal-width bars. For instance, treating the share \(7/15\) in a 15-kilometre bin as a height of \(7/15\) gives that bin an area of \(7\), rather than its intended share \(7/15\). The correction is to divide the share by the bin width, making the height \(7/225\) per kilometre; then the area is \((7/225)\cdot15=7/15\). Another common error is to describe a cumulative height as the share strictly below \(x\). Under the stated right-continuous definition, it includes records equal to \(x\).

Key takeaway: Survey weights determine how much each record contributes to the plotted distribution. On a normalized weighted histogram, bar area—not height alone—is the bin’s weighted share; on a weighted cumulative plot, the height at \(x\) is the weighted share at or below \(x\).

Check Your Understanding

Use the definitions and interpretations in this tutorial to answer the following.

  1. A normalized histogram bin has width 4 units and height 0.075 per unit. What weighted share does its area represent?
  2. Why can a wide histogram bar be shorter than a narrow bar while still representing a larger weighted share?
  3. For tied observations at the same value, what weight contributes to the jump in a weighted cumulative plot?
  4. What is the interpretation of the weighted cumulative plot’s height at a value \(x\)?
  5. What condition on the total weight is needed to define the normalized weighted share and weighted ECDF?
Clinical Biostats