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
Wbe a1 x nvector that corresponds to the median values for each column in them x nmatrix,M - Let
W = median(M) - Prove whether or not whether the median of
Wis 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 ofMifMwere 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.
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: