I just pulled this out of the voronoizer code I wrote a few weeks ago, because I ended up wanting it for another side project. Rather than jumping to pollution of hackage, I thought I’d do a quick poll if anyone thinks they’d ever use it.
I’m not sure I would use it, but this is very cool!
I’m not qualified to compare, but I know that there are several existing libraries for single-pass statistics:
Ah, thanks! If nothing else, that reminds me that one of the things I specifically wanted here was statistics on a vector space, which sadly I wasn’t able to find easily usable elsewhere. The packages you link to are indeed a great existing alternative if you are computing statistics on scalars!
Would it be possible to add the functionality monoidal-stats
has into e.g. monoid-statistics
?
Sounds quite reasonable to me! I filed Incorporate stats for vector spaces · Issue #8 · Shimuuar/monoid-statistics · GitHub to see there’s interest from the maintainer of that package. It seems recently maintained, so there’s probably reason to be hopeful here.
Just to jump on the “have you seen”’s, my foldl-statistics package also contains a type (LMVSKState) which computes the length, sum, mean, skewness and kurtosis of a set of Doubles and has a Monoid instance.
One thing that I had in mind since some time that seems related: You could have a finger tree indexed by a monoidal statistic. When adding further values to it, it automatically keeps the statistic of the whole set updated.