Safe Haskell | None |
---|---|

Language | Haskell2010 |

A histogram, if you squint, is a series of contiguous ranges, annotated with values.

## Synopsis

- data Histogram = Histogram {}
- data DealOvers
- fill :: (Functor f, Foldable f) => [Double] -> f Double -> Histogram
- regular :: Int -> [Double] -> Histogram
- makeRects :: DealOvers -> Histogram -> [Rect Double]
- regularQuantiles :: Double -> [Double] -> [Double]
- quantileFold :: [Double] -> Fold Double [Double]
- fromQuantiles :: [Double] -> [Double] -> Histogram
- freq :: Histogram -> Histogram

# Documentation

This Histogram is a list of contiguous boundaries (a boundary being the lower edge of one bucket and the upper edge of another), and a value (usually a count) for each bucket, represented here as a map

Overs and Unders are contained in key = 0 and key = length cuts

Whether or not to ignore unders and overs. If overs and unders are dealt with, IncludeOvers supplies an assumed width for the outer buckets.

fill :: (Functor f, Foldable f) => [Double] -> f Double -> Histogram Source #

Fill a Histogram using pre-specified cuts

`>>>`

Histogram {cuts = [0.0,50.0,100.0], values = fromList [(1,50.0),(2,50.0)]}`fill [0,50,100] [1..100]`

regular :: Int -> [Double] -> Histogram Source #

Make a histogram using n equally spaced cuts over the entire range of the data

`>>>`

Histogram {cuts = [0.0,25.0,50.0,75.0,100.0], values = fromList [(0,1.0),(1,25.0),(2,25.0),(3,25.0),(4,25.0)]}`regular 4 [0..100]`

makeRects :: DealOvers -> Histogram -> [Rect Double] Source #

Transform a Histogram to Rects

`>>>`

[Rect 0.0 25.0 0.0 0.25,Rect 25.0 50.0 0.0 0.25,Rect 50.0 75.0 0.0 0.25,Rect 75.0 100.0 0.0 0.25]`makeRects IgnoreOvers (regular 4 [0..100])`

regularQuantiles :: Double -> [Double] -> [Double] Source #

approx regular n-quantiles

`>>>`

[0.0,24.75,50.0,75.25,100.0]`regularQuantiles 4 [0..100]`