[R] runmed {stat}

Martin Maechler maechler at stat.math.ethz.ch
Mon Jan 23 09:08:39 CET 2017


>>>>> <someone>  on Sun, 22 Jan 2017 10:26:24 -0600 writes:

    > Dear Dr Mächler, I am using runmed from R's stat
    > package. I understand that you are the author of this package.

not of the package - but of function runmed().

I'm reply to R-help, so this answer maybe available to future
web searches.

    > I am using the function with even length k=40 and the
    > function forces it to be odd as k=41. I am sure there must
    > be reason behind this overriding behavior. May I ask if
    > you could enlighten me on this? Thank you in advance.

The help page - which one should really read (!) - says that k must be odd.

Why?  The median of an *odd* number of observations is "the
middle".  That's not the case with an even number, but a very
desirable property, which is kept even when iterating running
medians.
(Further, mathematically there are as many odd numbers as integers, so
 odd numbers should be sufficient ;-) ;-))

Martin Maechler
ETH Zurich



More information about the R-help mailing list