Opened 10 years ago
Closed 10 years ago
#7150 closed Support Requests (invalid)
What effect does the mean tag have on variance
| Reported by: | Owned by: | Eric Niebler | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | accumulator |
| Version: | Boost 1.49.0 | Severity: | Problem |
| Keywords: | Cc: |
Description
typedef accumulator_set<double, stats<tag::variance> > Var; typedef accumulator_set<double, stats<tag::variance, tag::mean> > VarMean;
Each of these constructs results in a different variance result. It is my understanding that they should be the same. Could you please tell me what I am missing?
Attachments (1)
Change History (4)
by , 10 years ago
| Attachment: | TestVar.cpp added |
|---|
follow-up: 2 comment:1 by , 10 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
The docs make a distinction between variance and lazy_variance, the former depends on count and immediate_mean, the latter on moment<2> and mean. By telling variance to depend instead on mean, you've changed how the computation is done. You now have a very strange variance accumulator that is neither fully immediate nor fully lazy.
In short: don't do that. :-)
comment:2 by , 10 years ago
| Resolution: | invalid |
|---|---|
| Status: | closed → reopened |
Thanks Eric. Does this mean that accumulators can only calculate one value at a time? Say I wanted to calculate mean, variance and kurtosis, would I need separate accumulators to avoid overwriting the dependencies?
This is what I initially expected to work: typedef accumulator_set<double, stats<tag::mean, tag::variance, tag::kurtosis> > stats;
comment:3 by , 10 years ago
| Resolution: | → invalid |
|---|---|
| Status: | reopened → closed |
Just use tag::immediate_mean instead of tag::mean. Please don't reopen this ticket. There isn't a bug here. If you have any further questions, please send them to the boost mailing list. Thanks.

Test program for variance