Skip to content
Oakfield Operator Calculus Function Reference Site

Variance

For samples {xi}i=1N\{x_i\}_{i=1}^{N} with mean μ\mu,

σ2=1Ni=1Nxiμ2\sigma^{2} = \frac{1}{N}\sum_{i=1}^{N} |x_i - \mu|^2

An unbiased estimator uses 1/(N1)1/(N-1) when treating the data as a sample from a larger population.

Requires finite second moment; applies to real or complex data. With the modulus-squared convention above, σ2\sigma^2 is always a nonnegative real number.


Translation-invariant: adding a constant to all samples leaves variance unchanged. With the modulus-squared convention, scaling obeys Var(cx)=c2Var(x)\operatorname{Var}(c x) = |c|^2 \operatorname{Var}(x) (for real cc this reduces to c2Var(x)c^2\operatorname{Var}(x)).


Zero variance if all samples are equal. For Gaussian data, variance equals the squared standard deviation parameter.


  • Constant samples give σ2=0\sigma^2=0.
  • For zero-mean signals, σ2\sigma^2 equals RMS2^2 (when RMS is defined with xi2x_i^2 or xi2|x_i|^2).

RMS combines variance and mean; Welford online statistics provide stable incremental updates.


Oakfield computes variances as part of SimFieldStats:

  • Component variances: var_re / var_im track population variance of real/imag components.
  • Magnitude variance: var_abs tracks variance of u|u| (useful when sign/phase is less meaningful than amplitude).
  • These feed thresholds/diagnostics (e.g. detecting instability, saturation, or noise growth).

Variance is the standard second central moment and measures typical spread around the mean.

It is a core diagnostic for uncertainty, noise, and stability monitoring and admits stable online update formulas for streaming settings.


  • Grimmett & Stirzaker, Probability and Random Processes
  • Chan, Golub, LeVeque, “Algorithms for Computing the Sample Variance” (1983)