So we want to reduce outliers by limiting each value to be within plus-or-minus 1 of the previous value, i.e. v_n = v_{(n-1)}\pm1

Now imagine a sequence with a clear outlier, for example \left\{ \frac{6}{10}, \frac{8}{10}, \frac{3}{10}, \frac{16}{10}, \frac{460}{10}, \frac{9}{10},\frac{1}{10}, \frac{-3}{10} \right\}. If we run through all the numbers (except for the first one since there isn’t a previous number to compare it against, we can create a list of changes, which is just the current number minus the previous one:

\left\{0, \frac{2}{10}, \frac{-5}{10}, \frac{13}{10}, \frac{444}{10}, \frac{-415}{10}, \frac{-8}{10}, \frac{-4}{10}\right\}

We then limit the changes to be within the [-1.0, 1.0] range:

\left\{0, \frac{2}{10}, \frac{-5}{10}, \frac{10}{10}, \frac{10}{10}, \frac{-10}{10}, \frac{-8}{10}, \frac{-4}{10}\right\}

If we reapply these clipped values to our original numbers, we find that the outlier has just moved one place to the right. The numerators here are the numerators of the original, previous values, plus the clipped changes.

\left\{ \frac{6}{10}, \frac{6+2}{10}, \frac{8-5}{10}, \frac{3+10}{10}, \frac{16+10}{10}, \frac{460-10}{10},\frac{9-8}{10}, \frac{1-4}{10} \right\} =

\hspace{50mm} \left\{ \frac{6}{10}, \frac{8}{10}, \frac{3}{10}, \frac{13}{10}, \frac{26}{10}, \frac{450}{10},\frac{1}{10}, \frac{-3}{10} \right\}

Not only is the outlier still there, there’s also still values that are more than the limit apart; 13 and 26.

One way out of this mess is to use an approach similar to what @Joseph_Oster posted. Instead of using random values to compute partial sums, you can use the clipped changes. This will guarantee that all values are within the same tolerance as their neighbours, however it may drastically change the actual shape of your distribution. You see if you were to have several slightly too big consecutive upward steps, you limit them all but your sequence still goes up the maximum allowed amount. Then if there’s a single *huge* downward step it is also clipped to the same range, so you only go down by a little bit. The remainder of your sequence will be much higher than the original.

For removal of outliers in signals the LULU operator (LULU smoothing) is a pretty good solution, but it’ll definitely require custom code to implement.