Weighted Median — Definition, Formula & Example
Weighted median is the middle value of a data set in which some values count more than others. You find it by tracking total weight instead of counting values, and stopping where half the weight is used up.
Let have nonnegative weights with total . A weighted median is any value for which the total weight of values below is at most and the total weight of values above is at most . If the running total equals exactly at some , every number from to qualifies, and a common convention averages and . When all weights are equal, the weighted median is the ordinary median.
Key Formula
Where:
- = the weighted median
- = the data values, sorted from least to greatest
- = the nonnegative weight attached to (a count, share, or importance)
- = the total of all weights
Worked Example
Problem: A food truck sold 100 items on Saturday: 10 items at $2, 30 at $3, 40 at $5, and 20 family meals at $20. Find the weighted median price, using the number sold as the weight.
Step 1: The prices are already sorted. Add the weights to get the total, then take half of it.
Step 2: Keep a running total of the weights. The running total first reaches 50 or more at the $5 price.
Step 3: Check both conditions for . The weight below $5 is 40, and the weight above $5 is 20. Neither is more than 50.
Answer: The weighted median price is $5. For comparison, the weighted mean is $7.10, which the $20 meals pull upward. The ordinary median of the four menu prices is $4, a price no customer actually paid.
Why It Matters
The US Census Bureau reports median household income from surveys in which each sampled household stands for a different number of households. That makes the published figure a weighted median. The weighted median also minimizes the total weighted distance , so it answers location problems such as where along a highway to put a warehouse that serves towns of different sizes.
Common Mistakes
Mistake: Taking the ordinary median of the listed values and ignoring the weights. In the example, this gives the average of $3 and $5, which is $4.
Correction: Each weight tells you how many times a value effectively appears. Use the running total of weights and find where it first reaches half of W. When the weights are counts, this matches the ordinary median of the fully written-out list of 100 sales.
