tdigest-0.3: On-line accumulation of rank-based statistics
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.TDigest.Postprocess

Synopsis

Histogram

class Affine f => HasHistogram a f | a -> f where Source #

Types from which we can extract histogram.

data HistBin Source #

Histogram bin

Constructors

HistBin 

Fields

Quantiles

median :: HasHistogram a f => a -> f Double Source #

Median, i.e. quantile 0.5.

quantile :: HasHistogram a f => Double -> a -> f Double Source #

Calculate quantile of a specific value.

Mean & variance

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

mean :: HasHistogram a f => a -> f Double Source #

Mean.

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

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

variance :: HasHistogram a f => a -> f Double Source #

Variance.

stddev :: HasHistogram a f => a -> f Double Source #

Standard deviation, square root of variance.

CDF

cdf :: HasHistogram a f => Double -> a -> Double Source #

Cumulative distribution function.

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

icdf :: HasHistogram a f => Double -> a -> f Double Source #

An alias for quantile.

Affine

class Traversable t => Affine t where Source #

Affine containers, i.e. containing at most 1 element

This class doesn't have traverse analogie as it would require using Pointed which is disputed type class.

traverseAff :: Pointed f => (a -> f b) -> t a -> f (t b)

Minimal complete definition

fromAffine | affine

Methods

affine :: b -> (a -> b) -> t a -> b Source #

Like foldMap

fromAffine :: a -> t a -> a Source #

Instances

Instances details
Affine Identity Source # 
Instance details

Defined in Data.TDigest.Postprocess.Internal

Methods

affine :: b -> (a -> b) -> Identity a -> b Source #

fromAffine :: a -> Identity a -> a Source #

Affine Maybe Source # 
Instance details

Defined in Data.TDigest.Postprocess.Internal

Methods

affine :: b -> (a -> b) -> Maybe a -> b Source #

fromAffine :: a -> Maybe a -> a Source #

Affine (Proxy :: Type -> Type) Source # 
Instance details

Defined in Data.TDigest.Postprocess.Internal

Methods

affine :: b -> (a -> b) -> Proxy a -> b Source #

fromAffine :: a -> Proxy a -> a Source #

(Affine f, Affine g) => Affine (Compose f g) Source #

Composition of Affine containers is Affine

Instance details

Defined in Data.TDigest.Postprocess.Internal

Methods

affine :: b -> (a -> b) -> Compose f g a -> b Source #

fromAffine :: a -> Compose f g a -> a Source #