Outliers and running medians

Since medians are less sensitive to outliers than means, a more robust alternative to running means replaces each value by the median of it and adjacent values. A 3-point running median is:

and higher-order running medians will use more adjacent values.

Comparison of means and medians

Running medians, followed by moving averages

To take advantage of the best features of both moving averages and running medians, these two techniques are often applied sequentially.