# smooth

0th

Percentile

##### Tukey's (Running Median) Smoothing

Tukey's smoothers, 3RS3R, 3RSS, 3R, etc.

Keywords
robust, smooth
##### Usage
smooth(x, kind = c("3RS3R", "3RSS", "3RSR", "3R", "3", "S"),
twiceit = FALSE, endrule = c("Tukey", "copy"), do.ends = FALSE)
##### Arguments
x
a vector or time series
kind
a character string indicating the kind of smoother required; defaults to "3RS3R".
twiceit
logical, indicating if the result should be ‘twiced’. Twicing a smoother $S(y)$ means $S(y) + S(y - S(y))$, i.e., adding smoothed residuals to the smoothed values. This decreases bias (increasing variance).
endrule
a character string indicating the rule for smoothing at the boundary. Either "Tukey" (default) or "copy".
do.ends
logical, indicating if the 3-splitting of ties should also happen at the boundaries (ends). This is only used for kind = "S".
##### Details

3 is Tukey's short notation for running medians of length 3, 3R stands for Repeated 3 until convergence, and S for Splitting of horizontal stretches of length 2 or 3. Hence, 3RS3R is a concatenation of 3R, S and 3R, 3RSS similarly, whereas 3RSR means first 3R and then (S and 3) Repeated until convergence -- which can be bad.

##### Value

An object of class "tukeysmooth" (which has print and summary methods) and is a vector or time series containing the smoothed values with additional attributes.

##### Note

S and S-PLUS use a different (somewhat better) Tukey smoother in smooth(*). Note that there are other smoothing methods which provide rather better results. These were designed for hand calculations and may be used mainly for didactical purposes. Since R version 1.2, smooth does really implement Tukey's end-point rule correctly (see argument endrule). kind = "3RSR" has been the default till R-1.1, but it can have very bad properties, see the examples. Note that repeated application of smooth(*) does smooth more, for the "3RS*" kinds.