Running medians

La fonction smooth proposes several predefined smoothers, namely "3RS3R", "3RSS", "3RSR", "3R", "3", et "S"; see the documentation for more details: help(smooth).

Examples

smooth(ts) | Uses default "3RS3R" |

smooth(ts,"3") | Running medians of span "3" |

smooth(ts,kind="3") | same |

smooth(ts,"3R",twiceit=TRUE) | Running medians, repeated and then twiced |

The function value of smooth() is the smoothed variable; to visualize it on a scatterplot, use something like:

plot(ts) lines(smooth(ts))

R has many more functions for smoothing time series, check the documentation.

Related functions

- The runmed function computes odd span running medians
- The han function in package LearnEDA

Related documents