# Updating mean and variance estimates

See Comparing three methods of computing standard deviation for examples of just how bad the above formula can be.There is a way to compute variance that is more accurate and is guaranteed to always give positive results.

I havn't checked the math whether it allows negative weights though, but at a first look it should!The most direct way of computing sample variance or standard deviation can have severe numerical problems.Mathematically, sample variance can be computed as follows.Cite ULike organises scholarly (or academic) papers or literature and provides bibliographic (which means it makes bibliographies) for universities and higher education establishments. People studying for Ph Ds or in postdoctoral (postdoc) positions.The service is similar in scope to End Note or Ref Works or any other reference manager like Bib Te X, but it is a social bookmarking service for scientists and humanities researchers.ABSTRACT: Gaussian random field (GRF) conditional simulation is a key ingredient in many spatial statistics problems for computing Monte-Carlo estimators and quantifying uncertainties on non-linear functionals of GRFs conditional on data.

Conditional simulations are known to often be computer intensive, especially when appealing to matrix decomposition approaches with a large number of simulation points.

I'm slightly familiar with the Chan et al approach, but thought of it as a one-pass method for computing a single variance over an entire sample, with the added advantage that the problem can be broken into parts that are run in parallel.

Chan et al gave a way to compute statistics for a concatenation of parts given the statistics of the parts.

I'm trying to find an efficient, numerically stable algorithm to calculate a rolling variance (for instance, a variance over a 20-period rolling window). Btw, shouldn't kahan sum be able to overcome numerical instabilities when using the "naive" approach (keeping track the sums of the values and their squares)? Just could not find any that were adapted to a rolling window.

I'm aware of the Welford algorithm that efficiently computes the running variance for a stream of numbers (it requires only one pass), but am not sure if this can be adapted for a rolling window. The Running Standard Deviations post by Subluminal Messages was critical in getting the rolling window formula to work.

This short note presents a method for efficiently updating ordinary kriging estimates and variances when one or more additional samples are incorporated into the kriging system.