title: What is best approach to detect outliers?
body: <p>I have a stream of numbers coming in and I want to flag them as 1 if outlier and 0 if not an outlier. I have two approaches for it:</p>
  
  <p>1) I calculate rolling mean of numbers coming in. Then, I calculate the rolling standard deviation of the calculated mean of numbers. With these values, I create confidence bound with (μ ± 3σ) <br><br>
  2) I calculate rolling mean and standard deviation of numbers coming in.  With these values, I create confidence bound with (μ ± 3σ)</p>
  
  <p>Which approach is better and why?</p>