In Boost.Accumulator, you can add samples to the battery, and then extract statistical quantities from it. eg:
acc(1.) acc(2.) acc(3.) cout << mean;
There are many more complex statistics in the library, such as skewness , kurtosis or p_square_cumulative_distribution .
What I would like to do is something like this:
acc(1.) acc(2.) acc(3.) std::cout << mean(acc);
pop() will work in FIFO (First In First Out) mode. What I'm trying to do is to calculate statistics for my data online (incremental) in a sliding time window.
The battery will have to internally store all values.
I could make my own, but I always wanted to check the existing libraries first, and maybe there is an algorithm that I donโt know about, that it is reasonable to calculate the quantities when data arrives or is sent.
source share