Page 1 sur 1

median of even-number sized lists

Publié : lun. janv. 29, 2018 3:11 am
par lukamar
Hello,

I've noticed that median command is producing the result 3 for the list [1,2,3,4,5,6]. But since its size is an even number, shouldn't the median be equal to the arithmetic mean of the elements surrounding the "middle" of the list, in this case 3.5 (Octave, for example, returns this result)?

Re: median of even-number sized lists

Publié : lun. janv. 29, 2018 8:32 am
par parisse
There are several definitions for median, the precise definition is not important to do descriptive statistics. I have selected the simplest to implement (and it also has the advantage that it can be extended to every kind of objects with an ordering, not necessarily requiring arithmetic operations).

Re: median of even-number sized lists

Publié : lun. janv. 29, 2018 12:20 pm
par lukamar
Thanks for the explanation. Now it's also clear why Octave developers chose the definition returning 3.5 in the above case, as they are focused almost exclusively on floating point computation.