num::basic_running_stats¶
Defined in header <stats/stats.hpp>
template <typename Float = double, std::integral Index = num::idx>
struct basic_running_stats;
Mean and variance of a stream of samples, by Welford's method.
Members¶
| member | description |
|---|---|
Float mean = Float{0} |
|
Float M2 = Float{0} |
|
Index count = 0 |
|
void update(Float x) |
Add the sample \(x\). |
Float variance() const |
Return the unbiased sample variance: \(s^2\); 0 with fewer than two samples. |
Float std_dev() const |
Return the sample standard deviation: \(s\). |
Float stderr_mean() const |
Return the standard error of the mean for uncorrelated samples: \(s / \sqrt{n}\). |
void reset() |
Discard all samples. |