Computing a mean of median list of points

Given a array of lists with the same number of here N = 10 elements:

SuperList = {{5., 4.99667, 4.99335, 4.99002, 4.98669, 4.98337, 4.98004, 4.97671, 4.97338, 4.97006}, {5., 4.99667, 4.99335, 4.99002, 4.98669, 4.98337, 4.98004, 4.97671, 4.97338, 4.97006}, {5., 4.99667, 4.99335, 4.99002, 4.98669, 4.98337, 4.98004, 4.97671, 4.97338, 4.97006}, {5.,4.99667, 4.99335, 4.99002, 4.98669, 4.98337, 4.98004, 4.97671, 4.97338, 4.97006}, {5.1, 5.09667, 5.09335, 5.09002, 5.08669, 5.08337, 5.08004, 5.07671, 5.07338, 5.07006}, {5., 5., 5., 5., 5., 5., 5., 5., 5., 5.}, {5., 5., 5., 5., 5., 5., 5., 5., 5., 5.}, {5., 5., 5., 5., 5., 5., 5., 5., 5., 5.}, {5., 5., 5., 5., 5., 5., 5., 5., 5., 5.}, {5., 4.99667, 4.99335, 4.99002, 4.98669, 4.98337, 4.98004, 4.97671, 4.97338, 4.97006}};

How do I efficiently compute an array, which we’ll call “MedianList” of length N where each element in the array is the median or mean of the sublist entries at the same index in the “SuperList”? For example, the first element would be:

MedianList[[1]] = Median[{5., 5., 5., 5., 5.1, 5., 5., 5., 5., 5.}];

The second element would be:

MedianList[[2]] = Median[{4.99667, 4.99667, 4.99667, 4.99667, 5.09667, 5., 5., 5., 5., 4.99667}];

And so forth.

=================

=================

1 Answer
1

=================

Doesn’t Median[SuperList] do just that?

From the documentation:

Median({{x1,y1,…},{x2,y2,…},…}) gives {Median[{x1,x2,…}],Median[{y1,y2,…}]}. Median({{x1,y1,…},{x2,y2,…},…}) gives {Median[{x1,x2,…}],Median[{y1,y2,…}]}. {\text{Median}}\left(\left\{\left\{x_1,y_1,\ldots \right\},\left\{x_2,y_2,\ldots \right\},\ldots \right\}\right)
\text{ gives }
\left\{\text{Median}\left[\left\{x_1,x_2,\ldots \right\}\right],\text{Median}\left[\left\{y_1,y_2,\ldots \right\}\right]\right\}
\text{. }

  

 

You’re right, but I don’t really like this – from MMA, not you. I would have done Median/@(Transpose@SuperList). Anyone have any insight as to why Median acts like this?
– N.J.Evans
Oct 27 ’15 at 20:51

1

 

@N.J.Evans: It’s consistent with most of the other statistical functions like Mean or Variance, which all treat a 2d array as a list of multivariate data samples. And if you’re working with multivariate data, that is very useful.
– nikie
Oct 28 ’15 at 7:28