Given the Mean and Variance of $n$ samples $x_i$:

$$M_n=\frac {1}{n}\sum_{1}^{n} x_i$$

$$V_n=\frac {1}{n}\sum_{1}^{n}(x_i-μ_n)^2$$

How do Mean and Variance change, when we take into account one more sample?

In other words, what are the function $f(x_n,\space...)$ and $g(x_n,\space...)$ such that:

$$M_n = f(x_n,\space n, \space M_{n-1})$$

$$V_n = g(x_n, \space n, \space M_{n-1}, \space V_{n-1})$$

Thank you!

  • 1
    $\begingroup$ Outliers defined as what? Often people define outliers as values that lie some number of standard deviations from the mean. In such case, it gets circular. $\endgroup$
    – Tim
    Jun 9 '19 at 9:11
  • $\begingroup$ ok I'll remove the word "outlier" to focus my question better. thanks! $\endgroup$
    – elemolotiv
    Jun 9 '19 at 9:12
  • 2
    $\begingroup$ This answer seems to give you what you're looking for: https://math.stackexchange.com/questions/374881/recursive-formula-for-variance $\endgroup$
    – rzch
    Jun 9 '19 at 10:38