tdigest-0.1: On-line accumulation of rank-based statistics

Safe HaskellNone
LanguageHaskell2010

Data.TDigest.Postprocess

Contents

Description

TDigest postprocessing functions.

These are re-exported from Data.TDigest module.

Synopsis

Histogram

histogram :: TDigest comp -> Maybe (NonEmpty HistBin) Source #

Calculate histogram based on the TDigest.

data HistBin Source #

Histogram bin

Constructors

HistBin 

Fields

Instances

Quantiles

median :: TDigest comp -> Maybe Double Source #

Median, i.e. quantile 0.5.

quantile :: Double -> TDigest comp -> Maybe Double Source #

Calculate quantile of a specific value.

Mean & variance

As we have "full" histogram, we can calculate other statistical variables.

mean :: TDigest comp -> Maybe Double Source #

Mean.

>>> mean (tdigest [1..100] :: TDigest 10)
Just 50.5

Note: if you only need the mean, calculate it directly.

mean' :: NonEmpty HistBin -> Double Source #

Mean from the histogram.

variance :: TDigest comp -> Maybe Double Source #

Variance.

variance' :: NonEmpty HistBin -> Double Source #

Variance from the histogram.

CDF

cdf :: Double -> TDigest comp -> Double Source #

Cumulative distribution function.

Note: if this is the only thing you need, it's more efficient to count this directly.

icdf :: Double -> TDigest comp -> Maybe Double Source #

Alias of quantile.

NonEmpty

histogram' :: NonEmpty (Mean, Weight) -> NonEmpty HistBin Source #

Histogram from centroids

quantile' :: Double -> Weight -> NonEmpty HistBin -> Double Source #

Quantile from the histogram.

Debug

validateHistogram :: Foldable f => f HistBin -> Either String (f HistBin) Source #

Validate that list of HistBin is a valid "histogram".