haskell / statistics

A fast, high quality library for computing with statistics in Haskell.
http://hackage.haskell.org/package/statistics
BSD 2-Clause "Simplified" License
300 stars 68 forks source link

exponential distribution: Fix fromSample. #190

Closed lorinder closed 1 year ago

lorinder commented 1 year ago

fromSample had a typo causing it to reject all valid samples (those contaning only nonnegative values), and accept only invalid ones.

Shimuuar commented 1 year ago

Thank you! I merged PR separately in #191. One thing correct way to check sample is:

    | G.all (>= 0) xs = Just $! ED (S.mean xs)
    | otherwise       = Nothing

This way we can reject NaNs.

Fix uploaded in 0.16.1.2