I am uploading a module I had written to compute the mean and the estimated variance in a streaming fashion as described here. I’ve wrapped it in a Monoid
for convinence. The module can be found here.
ghci> :l OMVar.lhs
ghci> let m1 = mconcat $ zipWith mkMeanVar (repeat 1) [1..10]
ghci> let m2 = mconcat $ zipWith mkMeanVar (repeat 1) [11..20]
ghci> print (meanVar m1)
(10.0,5.5,9.166666666666668)
ghci> print (meanVar $ m1 <> m2)
(20.0,10.5,35.0)