In reply to Yinliang Wu.

Thanks for writing. Hampel was a colleague of Tukey, and Tukey advocated repeating the first and last observations when choosing the points in the first few (and last few) windows. Hence, I used their method to illustrate the Hampel identifier and filter.

I agree with you that many modern time series methods use missing values instead. Equivalently, the first window is composed of the points {x1, x2, …, x_{k+1}}. That is why I support both methods in the ExtractWindow function. The pictures in my article are constructed by using
M = extractWindows(y, k); /* same as , M = extractWindows(y, k "REPEAT"); */
which results in a narrow band near the edges. If you use
M = extractWindows(y, k, . ); /* put missing value as 3rd arg */
then you will get wider bands near the ends of the series.