This is a bit of a mathematics problem, and a MATLAB problem.
In MATLAB, if I call median(M)
, where M
is an m x n
2D matrix, I get a list of n
values which represent the median value for each of the n
columns.
I'm trying to derive a proof (for my own curiosity) for:
- Let
W
be a1 x n
vector that corresponds to the median values for each column in them x n
matrix,M
- Let
W = median(M)
- Prove whether or not whether the median of
W
is always equal to the median value of all values ofM
- In MATLAB parlance, this would be akin to, "is
median(median(M))
the true median ofM
ifM
were normalized to a1 x (nm)
vector,V
, and we calculatedmedian(V)
.
- In MATLAB parlance, this would be akin to, "is
Is there an existing proof or general rule that dictates whether or not the median of a set of data is equal to the median of medians of any arbitrary subsets? Due to linearity, I can assume this to be true for the average (ie: arithmetic mean), but I'm not so sure about the mode and median operations.
Thank you.
Best Answer
It's not the same. To prove it, a counterexample suffices. There are two cases:
Even number of rows/columns: Matlab's definition of median implies an interpolation between the two central values.
Odd number of rows/columns: no interpolation needed; the median is just the central value: