Opened 10 years ago

Closed 10 years ago

#7150 closed Support Requests (invalid)

What effect does the mean tag have on variance

Reported by: colmearley@… 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)

TestVar.cpp (1.0 KB ) - added by colmearley@… 10 years ago.
Test program for variance

Download all attachments as: .zip

Change History (4)

by colmearley@…, 10 years ago

Attachment: TestVar.cpp added

Test program for variance

comment:1 by Eric Niebler, 10 years ago

Resolution: invalid
Status: newclosed

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. :-)

in reply to:  1 comment:2 by Colm Earley <colmearley@…>, 10 years ago

Resolution: invalid
Status: closedreopened

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 Eric Niebler, 10 years ago

Resolution: invalid
Status: reopenedclosed

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.

Note: See TracTickets for help on using tickets.