0
$\begingroup$

I have a time series $X_t \sim N(0, 1)$. There is a single outlier at index 347, at 8.5 standard deviations from the mean. If I now compute a rolling window standard deviation of $X_t$ with window size 100, we of course see a large spike at index 347.

Once this observation has fallen out of the 100 period window, the rolling standard deviation falls back down to normal levels at index 447 (347+100=447). This is all as expected.

My question is, what is this phenomenon formally called, because I wan't to research it more to be able to understand it and mitigate it. Specifically, once the outlier observation falls out of the rolling window, I do not want the standard deviation estimation to jump back down to normal levels.

I know some ways to mitigate this may be to time weigh or exponential-decay weigh the observations prior to estimating the standard deviation. But I am wondering what this phenomenon is called, if it even has a name, and if there are potentially other ways to mitigate it.

EDIT: Just for clarity, I am using an equal weighted rolling window, and at each point in time $t$ I can only use observations up to and including $t$ i.e. at time $t$, all observations $x$ used to estimate the standard deviation must be in $x_l, l\leq t$. This is to avoid lookahead bias. So any method that uses "future" information is not allowed.

enter image description here

enter image description here

enter image description here

$\endgroup$
5
  • $\begingroup$ You should look into other window functions. Looking up "kernel density estimation" will put you on the right track. $\endgroup$
    – Him
    Commented Apr 26, 2023 at 15:09
  • 1
    $\begingroup$ You are convolving your time series with a square wave. Since both the square wave and your time series are discontinuous, the convolution is discontinuous. If you use a smooth window function, then the convolution will be smooth. The Gaussian is one option for a window. There are other smooth options though with compact support. $\endgroup$
    – Him
    Commented Apr 26, 2023 at 15:23
  • $\begingroup$ Re "once the outlier observation falls out of the rolling window, I do not want the standard deviation estimation to jump back down to normal levels:" What, then, do you want it to do? What is it intended to represent? $\endgroup$
    – whuber
    Commented Apr 26, 2023 at 17:44
  • $\begingroup$ @whuber I want a robust estimator of the standard deviation, something like the MAD, or a time decaying estimate that captures the outlier when it happens, but then the standard deviation estimate should not "jump back down" once the outlier is out of the window. $\endgroup$
    – PyRsquared
    Commented May 3, 2023 at 7:04
  • $\begingroup$ But that's what I am asking about: just what would such an estimate mean or represent? $\endgroup$
    – whuber
    Commented May 3, 2023 at 14:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.