What is Weighted Median?
The weighted median is a measure of central tendency that accounts for the importance (weight) of each value in a dataset.
Unlike the simple median where each value has equal importance, the weighted median assigns different levels of significance to each data point. It's the value where the cumulative weight reaches 50% of the total weight, making it robust against outliers while considering the relative importance of observations.
The weighted median is commonly used in statistics, economics, image processing (for noise reduction), and data analysis. It's particularly valuable when different observations have different levels of reliability or importance, such as survey data weighted by demographics or financial data weighted by transaction volume.
Weighted Median Formula
To calculate the weighted median manually, follow these steps:
The weighted median accounts for the importance (weight) of each value. Values are sorted by value, then the cumulative weight is calculated until it exceeds half the total weight.
Example Calculation
For values [10, 20, 30] with weights [1, 3, 2], total weight is 6. Cumulative weights: 10→1, 20→4, 30→6. Half of total weight is 3. The cumulative weight first exceeds 3 at value 20 (cumulative = 4), so the weighted median is 20.
When to Use Weighted Median
The weighted median is essential in many real-world scenarios where data points have varying importance:
Survey Analysis
When analyzing survey responses weighted by demographic factors (age, income, location), the weighted median provides a representative measure that accounts for sample composition differences.
Image Processing
In digital image processing, the weighted median filter is used for noise reduction. Pixels closer to the center receive higher weights, effectively removing noise while preserving edges better than simple averaging.
Financial Data
When calculating typical transaction values or portfolio performance, transactions can be weighted by their volume or importance, giving larger transactions appropriate influence on the result.