histogram-fill icon indicating copy to clipboard operation
histogram-fill copied to clipboard

Mean and variance functions?

Open idontgetoutmuch opened this issue 8 years ago • 3 comments

I just wrote this. Maybe it would be worth adding a mean and variance function? Obviously we could make them just one traversal.

marginal1X, marginal1Y :: H.Histogram BinD Double
marginal1X = H.reduceX H.sum test
marginal1Y = H.reduceY H.sum test

m0X1 = H.sum marginal1X
m1X1 = H.sum $ H.bmap (\f v -> v * f) marginal1X
m2X1 = H.sum $ H.bmap (\f v -> v^2 * f) marginal1X
muX1 = m1X1 / m0X1
varX1 = (m2X1 / m0X1) - muX1^2

idontgetoutmuch avatar Oct 05 '17 07:10 idontgetoutmuch

It certainly makes sense. But at the moment I'm working on big change to binning algorithm so I don't want to add new functions right now.

Shimuuar avatar Oct 05 '17 17:10 Shimuuar

Ping @Shimuuar ! :)

ocramz avatar May 20 '19 11:05 ocramz

Oh! I totally forgot about it. I have few half-baked idea an d almost no time :(

Shimuuar avatar May 21 '19 20:05 Shimuuar