Skip to content

runmed {stat}

1 message · Martin Maechler

#
> 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