runmed {stats} | R Documentation |
Running Medians – Robust Scatter Plot Smoothing
Description
Compute running medians of odd span. This is the “most robust” scatter plot smoothing possible. For efficiency (and historical reason), you can use one of two different algorithms giving identical results.
Usage
runmed(x, k, endrule = c("median", "keep", "constant"),
algorithm = NULL, print.level = 0)
Arguments
x |
numeric vector, the “dependent” variable to be smoothed. |
k |
integer width of median window; must be odd. Turlach had a
default of |
endrule |
character string indicating how the values at the beginning and the end (of the data) should be treated.
|
algorithm |
character string (partially matching |
print.level |
integer, indicating verboseness of algorithm; should rarely be changed by average users. |
Details
Apart from the end values, the result y = runmed(x, k)
simply has
y[j] = median(x[(j-k2):(j+k2)])
(k = 2*k2+1), computed very
efficiently.
The two algorithms are internally entirely different:
- "Turlach"