statistics icon indicating copy to clipboard operation
statistics copied to clipboard

Inconsistent behavior of exstimators for null samples

Open Shimuuar opened this issue 9 years ago • 2 comments

Functions for estimation of various statistics have inconsistent behavior for samples of insufficient size. For example for empty sample

  • mean returns NaN
  • welfordMean returns 0
  • Quantile.weightedAvg throws exception.

It's not clear what is correct behavior. One possibility is to simply return Maybe when estimate is impossible but that will require constant unwrapping of Maybes so I'm not sure it's good thing

was brought up in #94

Shimuuar avatar Jul 25 '16 17:07 Shimuuar

I absolutely prefer returning Maybe.

Wrt unwrapping, are you talking about a performance issue? I don't see how this is a practical issue.

alexanderkjeldaas avatar Sep 24 '17 17:09 alexanderkjeldaas

I lean towards this solution as well.

By unwrapping I mean that whenever we use mean we have to handle Nothing case. On one hand it's right thing on other it's annoying when you do quick and dirty data exploration. I wonder whether we should provide set of function which call error when encounter insufficient data

Shimuuar avatar Sep 28 '17 13:09 Shimuuar