|
numerics
|
#include <stats.hpp>
Public Member Functions | |
| void | update (real x) |
| Incorporate one new sample. | |
| real | variance () const |
| Unbiased sample variance (n-1 denominator). Returns 0 for n < 2. | |
| real | std_dev () const |
| real | stderr_mean () const |
| Standard error of the mean (uncorrelated samples). | |
| void | reset () |
Public Attributes | |
| real | mean = 0.0 |
| real | M2 = 0.0 |
| idx | count = 0 |
Online mean and variance via Welford's algorithm. One-pass, numerically stable, O(1) memory.
|
inline |
|
inline |
Definition at line 37 of file stats.hpp.
References variance().
Referenced by main(), and stderr_mean().
|
inline |
|
inline |
| idx num::RunningStats::count = 0 |
Definition at line 21 of file stats.hpp.
Referenced by main(), reset(), stderr_mean(), update(), and variance().
| real num::RunningStats::M2 = 0.0 |
Definition at line 20 of file stats.hpp.
Referenced by reset(), update(), and variance().
| real num::RunningStats::mean = 0.0 |