ArticleslgStudy

mathematics

Weighted median

Weighted median is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Weighted median rather than just read about it. In short: In statistics, a weighted median of a sample is the 50% weighted percentile. It was first proposed by F.

Weighted median — main illustration
Weighted median — illustration

Key takeaways

  • Weighted median belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Weighted median to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Weighted median from memory before moving on to harder problems.

Reference excerpt

In statistics, a weighted median of a sample is the 50% weighted percentile. It was first proposed by F. Y. Edgeworth in 1888. Like the median, it is useful as an estimator of central tendency, robust against outliers. It allows for non-uniform statistical weights related to, e.g., varying precision measurements in the sample.

Definition

General case For n distinct ordered elements x1,x2,...,xn with positive weights w1,w2,...,wn such that ∑i=1nwi=1, the weighted median is the element xk satisfying

∑i=1k−1wi≤1/2 and ∑i=k+1nwi≤1/2

Special case Consider a set of elements in which two of the elements satisfy the general case. This occurs when both element's respective weights border the midpoint of the set of weights without encapsulating it; Rather, each element defines a partition equal to 1/2. These elements are referred to as the lower weighted median and upper weighted median. Their conditions are satisfied as follows: Lower Weighted Median

∑i=1k−1wi<1/2 and ∑i=k+1nwi=1/2 Upper Weighted Median

∑i=1k−1wi=1/2 and ∑i=k+1nwi<1/2 Ideally, a new element would be created using the mean of the upper and lower weighted medians and assigned a weight of zero. This method is similar to finding the median of an even set. The new element would be a true median since the sum of the weights to either side of this partition point would be equal. Depending on the application, it may not be possible or wise to create new data. In this case, the weighted median should be chosen based on which element keeps the partitions most equal. This will always be the weighted median with the lowest weight. In the event that the upper and lower weighted medians are equal, the lower weighted median is generally accepted as originally proposed by Edgeworth.

Properties The sum of weights in each of the two partitions should be as equal as possible. If the weights of all numbers in the set are equal, then the weighted median reduces down to the median.

Examples For simplicity, consider the set of numbers {1,2,3,4,5} with each number having weights {0.15,0.1,0.2,0.3,0.25} respectively. The median is 3 and the weighted median is the element corresponding to the weight 0.3, which is 4. The weights on each side of the pivot add up to 0.45 and 0.25, satisfying the general condition that each side be as even as possible. Any other weight would result in a greater difference between each side of the pivot. Consider the set of numbers {1,2,3,4} with each number having uniform weights {0.25,0.25,0.25,0.25} respectively. Equal weights should result in a weighted median equal to the median. This median is 2.5 since it is an even set. The lower weighted median is 2 with partition sums of 0.25 and 0.5, and the upper weighted median is 3 with partition sums of 0.5 and 0.25. These partitions each satisfy their respective special condition and the general condition. It is ideal to introduce a new pivot by taking the mean of the upper and lower weighted medians when they exist. With this, the set of numbers is {1,2,2.5,3,4} with each number having weights {0.25,0.25,0,0.25,0.25} respectively. This creates partitions that both sum to 0.5. It can easily be seen that the weighted median and median are the same for any size set with equal weights. Similarly, consider the set of numbers {1,2,3,4} with each number having weights {0.49,0.01,0.25,0.25} respectively. The lower weighted median is 2 with partition sums of 0.49 and 0.5, and the upper weighted median is 3 with partition sums of 0.5 and 0.25. In the case of working with integers or non-interval measures, the lower weighted median would be accepted since it is the lower weight of the pair and therefore keeps the partitions most equal. However, it is more ideal to take the mean of these weighted medians when it makes sense instead. Coincidentally, both the weighted median and median are equal to 2.5, but this will not always hold true for larger sets depending on the weight distribution.

Algorithm The weighted median can be computed by sorting the set of numbers and finding the smallest set of numbers which sum to half the weight of the total weight. This algorithm takes O(nlog⁡n) time. There is a better approach to find the weighted median using a modified selection algorithm.

Software/source code A fast weighted median algorithm is implemented in a C extension for Python in the Robustats Python package. R has many implementations, including matrixStats::weightedMedian(), spatstat::weighted.median(), and others.

See also Weighted arithmetic mean Least absolute deviations Median filter Quickselect

References

Illustrations

Weighted median: The top chart shows a list of elements with values indicated by height and the median element shown in red. The lower chart shows the same elements with weights as indicated by the width of the boxes. The weighted median is shown in red and is different than the ordinary median.
The top chart shows a list of elements with values indicated by height and the median element shown in red. The lower chart shows the same elements with weights as indicated by the width of the boxes. The weighted median is shown in red and is different than the ordinary median.

Worked examples

Example 1 — a first encounter with Weighted median

Start with the simplest possible case. Write down what Weighted median claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Weighted median before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Weighted median ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Weighted median

In research
Weighted median appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Weighted median in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Weighted median is common in secondary-school and first-year university syllabi. It links to neighbouring topics Means, Robust statistics, so understanding it makes those chapters shorter.
In everyday life
Look for Weighted median outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Weighted median” →

How to study Weighted median in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Weighted median means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Weighted median out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Weighted median in simple terms?

In statistics, a weighted median of a sample is the 50% weighted percentile. It was first proposed by F.

Why does Weighted median matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Weighted median?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Weighted median.

Tags

  • Means
  • Robust statistics

Keep exploring