# Why does component-wise median not make sense in higher dimensions?

I would like to compute the median of a higher-dimensional point set by computing the component-wise median for each individual dimension. The point that consists of the medians of each individual dimension is then the median of the higher-dimensional point set.

According to this book, this is not a good idea, because the one-dimensional concept of the median does not simply extend element-wise to higher dimensions.

Why is this? Can anybody provide an example of a case where this approach fails and gives a nonsense result?

I understand that this higher-dimensional median is not necessarily an element of the point set, but it still has the properties of being a meaningful measure of location and being robust to outliers.

• What you're describing (the vector of component-wise medians) is called the marginal median. There are various ways to generalize the median to multivariate settings, including the marginal median, the L1 median, and the center point. Each of these reduce to the standard median in 1d, but have different properties in higher dimensions. I wouldn't say that the marginal median doesn't make sense. In fact, people have used it for various applications. Rather, it depends on what properties matter in your particular problem. – user20160 Apr 8 at 17:21
• @user20160 thanks a lot, you should post that as an answer! – Alex Apr 8 at 18:40
• You could Look at the concept of a half-mass space – Sebastian Apr 13 at 4:50

The underlying concept is that a median splits the data (or a distribution) into two halves with equal amounts in each half (by count or probability).

Even in one dimension the median is problematic. When clustering occurs, one cluster of values may be near $$x_0$$ and another cluster near $$x_1,$$ far from $$x_0.$$ Slight changes in the amount of data (or probability) can shift the median from one cluster to the other. But, at the least, a median can always be located close to some data values or probability support. Therefore we shouldn't complain about multidimensional examples of the same phenomenon.

The fundamental problem is that the point whose coordinates are the marginal medians can be located unreasonably far from any data values (or probability).

Here's an extreme example in three dimensions. Consider a nine-element dataset consisting of one value near $$(1,0,0),$$ two values near $$(0,1,0),$$ and three values each near $$(0,0,1)$$ and $$(1,1,1).$$ Such data often arise when the values are proportions: in such cases anything outside the cube is meaningless and values near the corners (as in this dataset) are extreme.

$$\begin{array}{lll|r} \text{x}&\text{y} &\text{z}& \text{Count} \\ \hline 1 & 0 & 0 & 1 \\ 0 & 1 & 0 & 2 \\ 0 & 0 & 1 & 3 \\ 1 & 1 & 1 & 3 \\ \hline 0 & 1 & 1 & \text{median} \end{array}$$

These data are located near four corners of the unit cube:

The blue starbursts indicate the data locations. Their sizes reflect the amount of data at each location: you can see there is a preponderance of values in the back, to the right, and at the top.

You can check that the medians of the coordinates in this dataset are near $$0,$$ $$1,$$ and $$1,$$ respectively. For instance, four of the nine values of the first coordinate equal $$1$$ and the other five are near $$0,$$ putting their median near $$0.$$

Consequently, the point of marginal medians is $$(0,1,1).$$ But this isn't anywhere near any of the data--indeed, it's about as far from any of them as one can possibly get. We would struggle to interpret such a "median" as the center of anything. All the data lie (relatively far) to one side of it.

For alternative approaches, please see our thread on multivariate generalizations of the median.

• If you use a non-euclidean distance metric such as the taxicab (or Manhattan) metric, the presented median is optimal. – ciamej Apr 9 at 11:32
• @ciamej Yes, that's a good observation. The median and the marginal median enjoy useful properties, especially in relation to the $L^1$ metric and robustness. The purpose of the present thread, though, is to appreciate the sense in which the marginal median might fail to generalize some of the properties it enjoys in one dimension. – whuber Apr 9 at 12:10