statistics-0.16.4.0: A library of statistical types, data, and functions

Copyright | (c) 2009 Bryan O'Sullivan
License | BSD3
Maintainer | bos@serpentine.com
Stability | experimental
Portability | portable
Safe Haskell | None
Language | Haskell2010

Statistics.Quantile

Contents

- Quantile estimation functions
  - Parameters for the continuous sample method
- Other algorithms
- Median & other specializations
- Deprecated
- References

Description

Functions for approximating quantiles, i.e. points taken at regular intervals from the cumulative distribution function of a random variable.

The number of quantiles is described below by the variable q, so with q=4, a 4-quantile (also known as a quartile) has 4 intervals, and contains 5 points. The parameter k describes the desired point, where 0 ≤ k ≤ q.

Synopsis

- data ContParam = ContParam !Double !Double
- class Default a where
  - def :: a
- quantile :: Vector v Double => ContParam -> Int -> Int -> v Double -> Double
- quantiles :: (Vector v Double, Foldable f, Functor f) => ContParam -> f Int -> Int -> v Double -> f Double
- quantilesVec :: (Vector v Double, Vector v Int) => ContParam -> v Int -> Int -> v Double -> v Double
- cadpw :: ContParam
- hazen :: ContParam
- spss :: ContParam
- s :: ContParam
- medianUnbiased :: ContParam
- normalUnbiased :: ContParam
- weightedAvg :: Vector v Double => Int -> Int -> v Double -> Double
- median :: Vector v Double => ContParam -> v Double -> Double
- mad :: Vector v Double => ContParam -> v Double -> Double
- midspread :: Vector v Double => ContParam -> Int -> v Double -> Double
- continuousBy :: Vector v Double => ContParam -> Int -> Int -> v Double -> Double

# Quantile estimation functions

Below is family of functions which use same algorithm for estimation of sample quantiles. It approximates empirical CDF as continuous piecewise function which interpolates linearly between points \((X_k,p_k)\) where \(X_k\) is k-th order statistics (k-th smallest element) and \(p_k\) is probability corresponding to it. `ContParam` determines how \(p_k\) is chosen. For more detailed explanation see [Hyndman1996].

This is the method used by most statistical software, such as R, Mathematica, SPSS, and S.

data ContParam Source #

Parameters α and β to the `continuousBy` function. Exact meaning of parameters is described in [Hyndman1996] in section "Piecewise linear functions"

Constructors

ContParam !Double !Double |

#### Instances

Instances details

FromJSON ContParam Source # |
Instance details Defined in Statistics.Quantile Methods parseJSON :: Value -> Parser ContParam Source # parseJSONList :: Value -> Parser [ContParam] Source # omittedField :: Maybe ContParam Source #
ToJSON ContParam Source # |
Instance details Defined in Statistics.Quantile Methods toJSON :: ContParam -> Value Source # toEncoding :: ContParam -> Encoding Source # toJSONList :: [ContParam] -> Value Source # toEncodingList :: [ContParam] -> Encoding Source # omitField :: ContParam -> Bool Source #
Binary ContParam Source # |
Instance details Defined in Statistics.Quantile Methods put :: ContParam -> Put Source # get :: Get ContParam Source # putList :: [ContParam] -> Put Source #
Default ContParam Source # | We use `s` as default value which is same as R's default.
Instance details Defined in Statistics.Quantile Methods def :: ContParam #
Data ContParam Source # |

Instance details

Defined in Statistics.Quantile

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ContParam -> c ContParam Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ContParam Source #

toConstr :: ContParam -> Constr Source #

dataTypeOf :: ContParam -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ContParam) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ContParam) Source #

gmapT :: (forall b. Data b => b -> b) -> ContParam -> ContParam Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ContParam -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ContParam -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> ContParam -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ContParam -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ContParam -> m ContParam Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ContParam -> m ContParam Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ContParam -> m ContParam Source #

Generic ContParam Source # |

Instance details

Defined in Statistics.Quantile

Associated Types

type Rep ContParam |

Instance details

Defined in Statistics.Quantile

type Rep ContParam = D1 ('MetaData "ContParam" "Statistics.Quantile" "statistics-0.16.4.0-CwUrX7BVOPjWfNRlOxuPU" 'False) (C1 ('MetaCons "ContParam" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Double) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Double)))

Methods

from :: ContParam -> Rep ContParam x Source #

to :: Rep ContParam x -> ContParam Source #

Show ContParam Source # |
Instance details Defined in Statistics.Quantile Methods showsPrec :: Int -> ContParam -> ShowS Source # show :: ContParam -> String Source # showList :: [ContParam] -> ShowS Source #
Eq ContParam Source # |
Instance details Defined in Statistics.Quantile Methods (==) :: ContParam -> ContParam -> Bool Source # (/=) :: ContParam -> ContParam -> Bool Source #
Ord ContParam Source # |

Instance details

Defined in Statistics.Quantile

Methods

compare :: ContParam -> ContParam -> Ordering Source #

(<) :: ContParam -> ContParam -> Bool Source #

(<=) :: ContParam -> ContParam -> Bool Source #

(>) :: ContParam -> ContParam -> Bool Source #

(>=) :: ContParam -> ContParam -> Bool Source #

max :: ContParam -> ContParam -> ContParam Source #

min :: ContParam -> ContParam -> ContParam Source #

type Rep ContParam Source # |

Instance details

Defined in Statistics.Quantile

type Rep ContParam = D1 ('MetaData "ContParam" "Statistics.Quantile" "statistics-0.16.4.0-CwUrX7BVOPjWfNRlOxuPU" 'False) (C1 ('MetaCons "ContParam" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Double) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Double)))

class Default a where #

Minimal complete definition

Nothing

Methods

def :: a #

#### Instances

Instances details

Default IntSet |
Instance details Defined in Data.Default.Internal Methods def :: IntSet #
Default All |
Instance details Defined in Data.Default.Internal Methods def :: All #
Default Any |
Instance details Defined in Data.Default.Internal Methods def :: Any #
Default CBool |
Instance details Defined in Data.Default.Internal Methods def :: CBool #
Default CClock |
Instance details Defined in Data.Default.Internal Methods def :: CClock #
Default CDouble |
Instance details Defined in Data.Default.Internal Methods def :: CDouble #
Default CFloat |
Instance details Defined in Data.Default.Internal Methods def :: CFloat #
Default CInt |
Instance details Defined in Data.Default.Internal Methods def :: CInt #
Default CIntMax |
Instance details Defined in Data.Default.Internal Methods def :: CIntMax #
Default CIntPtr |
Instance details Defined in Data.Default.Internal Methods def :: CIntPtr #
Default CLLong |
Instance details Defined in Data.Default.Internal Methods def :: CLLong #
Default CLong |
Instance details Defined in Data.Default.Internal Methods def :: CLong #
Default CPtrdiff |
Instance details Defined in Data.Default.Internal Methods def :: CPtrdiff #
Default CSUSeconds |
Instance details Defined in Data.Default.Internal Methods def :: CSUSeconds #
Default CShort |
Instance details Defined in Data.Default.Internal Methods def :: CShort #
Default CSigAtomic |
Instance details Defined in Data.Default.Internal Methods def :: CSigAtomic #
Default CSize |
Instance details Defined in Data.Default.Internal Methods def :: CSize #
Default CTime |
Instance details Defined in Data.Default.Internal Methods def :: CTime #
Default CUInt |
Instance details Defined in Data.Default.Internal Methods def :: CUInt #
Default CUIntMax |
Instance details Defined in Data.Default.Internal Methods def :: CUIntMax #
Default CUIntPtr |
Instance details Defined in Data.Default.Internal Methods def :: CUIntPtr #
Default CULLong |
Instance details Defined in Data.Default.Internal Methods def :: CULLong #
Default CULong |
Instance details Defined in Data.Default.Internal Methods def :: CULong #
Default CUSeconds |
Instance details Defined in Data.Default.Internal Methods def :: CUSeconds #
Default CUShort |
Instance details Defined in Data.Default.Internal Methods def :: CUShort #
Default IntPtr |
Instance details Defined in Data.Default.Internal Methods def :: IntPtr #
Default WordPtr |
Instance details Defined in Data.Default.Internal Methods def :: WordPtr #
Default Int16 |
Instance details Defined in Data.Default.Internal Methods def :: Int16 #
Default Int32 |
Instance details Defined in Data.Default.Internal Methods def :: Int32 #
Default Int64 |
Instance details Defined in Data.Default.Internal Methods def :: Int64 #
Default Int8 |
Instance details Defined in Data.Default.Internal Methods def :: Int8 #
Default Word16 |
Instance details Defined in Data.Default.Internal Methods def :: Word16 #
Default Word32 |
Instance details Defined in Data.Default.Internal Methods def :: Word32 #
Default Word64 |
Instance details Defined in Data.Default.Internal Methods def :: Word64 #
Default Word8 |
Instance details Defined in Data.Default.Internal Methods def :: Word8 #
Default Ordering |
Instance details Defined in Data.Default.Internal Methods def :: Ordering #
Default NewtonParam |
Instance details Defined in Numeric.RootFinding Methods def :: NewtonParam #
Default RiddersParam |
Instance details Defined in Numeric.RootFinding Methods def :: RiddersParam #
Default ContParam Source # | We use `s` as default value which is same as R's default.
Instance details Defined in Statistics.Quantile Methods def :: ContParam #
Default Integer |
Instance details Defined in Data.Default.Internal Methods def :: Integer #
Default () |
Instance details Defined in Data.Default.Internal Methods def :: () #
Default Bool |
Instance details Defined in Data.Default.Internal Methods def :: Bool #
Default Double |
Instance details Defined in Data.Default.Internal Methods def :: Double #
Default Float |
Instance details Defined in Data.Default.Internal Methods def :: Float #
Default Int |
Instance details Defined in Data.Default.Internal Methods def :: Int #
Default Word |
Instance details Defined in Data.Default.Internal Methods def :: Word #
(Default a, RealFloat a) => Default (Complex a) |
Instance details Defined in Data.Default.Internal Methods def :: Complex a #
Default (IntMap v) |
Instance details Defined in Data.Default.Internal Methods def :: IntMap v #
Default (Seq a) |
Instance details Defined in Data.Default.Internal Methods def :: Seq a #
Default (Set v) |
Instance details Defined in Data.Default.Internal Methods def :: Set v #
Default a => Default (Tree a) |
Instance details Defined in Data.Default.Internal Methods def :: Tree a #
Default a => Default (Identity a) |
Instance details Defined in Data.Default.Internal Methods def :: Identity a #
Default (First a) |
Instance details Defined in Data.Default.Internal Methods def :: First a #
Default (Last a) |
Instance details Defined in Data.Default.Internal Methods def :: Last a #
Default a => Default (Dual a) |
Instance details Defined in Data.Default.Internal Methods def :: Dual a #
Default (Endo a) |
Instance details Defined in Data.Default.Internal Methods def :: Endo a #
Num a => Default (Product a) |
Instance details Defined in Data.Default.Internal Methods def :: Product a #
Num a => Default (Sum a) |
Instance details Defined in Data.Default.Internal Methods def :: Sum a #
Default (ConstPtr a) |
Instance details Defined in Data.Default.Internal Methods def :: ConstPtr a #
Default (FunPtr a) |
Instance details Defined in Data.Default.Internal Methods def :: FunPtr a #
Default (Ptr a) |
Instance details Defined in Data.Default.Internal Methods def :: Ptr a #
Integral a => Default (Ratio a) |
Instance details Defined in Data.Default.Internal Methods def :: Ratio a #
Default (Maybe a) |
Instance details Defined in Data.Default.Internal Methods def :: Maybe a #
Default a => Default (Solo a) |
Instance details Defined in Data.Default.Internal Methods def :: Solo a #
Default [a] |
Instance details Defined in Data.Default.Internal Methods def :: [a] #
HasResolution a => Default (Fixed a) |
Instance details Defined in Data.Default.Internal Methods def :: Fixed a #
Default (Map k v) |
Instance details Defined in Data.Default.Internal Methods def :: Map k v #
Default (Proxy a) |
Instance details Defined in Data.Default.Internal Methods def :: Proxy a #
(Default a1, Default a2) => Default (a1, a2) |
Instance details Defined in Data.Default.Internal Methods def :: (a1, a2) #
Default a => Default (Const a b) |
Instance details Defined in Data.Default.Internal Methods def :: Const a b #
(Default a1, Default a2, Default a3) => Default (a1, a2, a3) |
Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3) #
(Default a1, Default a2, Default a3, Default a4) => Default (a1, a2, a3, a4) |
Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4) #
(Default a1, Default a2, Default a3, Default a4, Default a5) => Default (a1, a2, a3, a4, a5) |
Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5) #
(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6) => Default (a1, a2, a3, a4, a5, a6) |
Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6) #
(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7) => Default (a1, a2, a3, a4, a5, a6, a7) |
Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7) #
(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7, Default a8) => Default (a1, a2, a3, a4, a5, a6, a7, a8) |
Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7, a8) #
(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7, Default a8, Default a9) => Default (a1, a2, a3, a4, a5, a6, a7, a8, a9) |
Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7, a8, a9) #
(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7, Default a8, Default a9, Default a10) => Default (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) |
Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) #
(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7, Default a8, Default a9, Default a10, Default a11) => Default (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) |
Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) #
(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7, Default a8, Default a9, Default a10, Default a11, Default a12) => Default (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) |
Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) #
(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7, Default a8, Default a9, Default a10, Default a11, Default a12, Default a13) => Default (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) |
Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) #
(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7, Default a8, Default a9, Default a10, Default a11, Default a12, Default a13, Default a14) => Default (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) |
Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) #
(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7, Default a8, Default a9, Default a10, Default a11, Default a12, Default a13, Default a14, Default a15) => Default (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) |
Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) #
(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7, Default a8, Default a9, Default a10, Default a11, Default a12, Default a13, Default a14, Default a15, Default a16) => Default (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) |
Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) #
(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7, Default a8, Default a9, Default a10, Default a11, Default a12, Default a13, Default a14, Default a15, Default a16, Default a17) => Default (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) |
Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) #
(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7, Default a8, Default a9, Default a10, Default a11, Default a12, Default a13, Default a14, Default a15, Default a16, Default a17, Default a18) => Default (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18) |
Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18) #
(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7, Default a8, Default a9, Default a10, Default a11, Default a12, Default a13, Default a14, Default a15, Default a16, Default a17, Default a18, Default a19) => Default (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19) |
Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19) #
(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7, Default a8, Default a9, Default a10, Default a11, Default a12, Default a13, Default a14, Default a15, Default a16, Default a17, Default a18, Default a19, Default a20) => Default (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) |
Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) #
(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7, Default a8, Default a9, Default a10, Default a11, Default a12, Default a13, Default a14, Default a15, Default a16, Default a17, Default a18, Default a19, Default a20, Default a21) => Default (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21) |
Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21) #
(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7, Default a8, Default a9, Default a10, Default a11, Default a12, Default a13, Default a14, Default a15, Default a16, Default a17, Default a18, Default a19, Default a20, Default a21, Default a22) => Default (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22) |
Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22) #

(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7, Default a8, Default a9, Default a10, Default a11, Default a12, Default a13, Default a14, Default a15, Default a16, Default a17, Default a18, Default a19, Default a20, Default a21, Default a22, Default a23) => Default (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23)

Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23) #

(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7, Default a8, Default a9, Default a10, Default a11, Default a12, Default a13, Default a14, Default a15, Default a16, Default a17, Default a18, Default a19, Default a20, Default a21, Default a22, Default a23, Default a24) => Default (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24)

Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24) #

(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7, Default a8, Default a9, Default a10, Default a11, Default a12, Default a13, Default a14, Default a15, Default a16, Default a17, Default a18, Default a19, Default a20, Default a21, Default a22, Default a23, Default a24, Default a25) => Default (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25)

Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25) #

(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7, Default a8, Default a9, Default a10, Default a11, Default a12, Default a13, Default a14, Default a15, Default a16, Default a17, Default a18, Default a19, Default a20, Default a21, Default a22, Default a23, Default a24, Default a25, Default a26) => Default (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26)

Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26) #

(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7, Default a8, Default a9, Default a10, Default a11, Default a12, Default a13, Default a14, Default a15, Default a16, Default a17, Default a18, Default a19, Default a20, Default a21, Default a22, Default a23, Default a24, Default a25, Default a26, Default a27) => Default (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27)

Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27) #

(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7, Default a8, Default a9, Default a10, Default a11, Default a12, Default a13, Default a14, Default a15, Default a16, Default a17, Default a18, Default a19, Default a20, Default a21, Default a22, Default a23, Default a24, Default a25, Default a26, Default a27, Default a28) => Default (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28)

Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28) #

(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7, Default a8, Default a9, Default a10, Default a11, Default a12, Default a13, Default a14, Default a15, Default a16, Default a17, Default a18, Default a19, Default a20, Default a21, Default a22, Default a23, Default a24, Default a25, Default a26, Default a27, Default a28, Default a29) => Default (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29)

Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29) #

(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7, Default a8, Default a9, Default a10, Default a11, Default a12, Default a13, Default a14, Default a15, Default a16, Default a17, Default a18, Default a19, Default a20, Default a21, Default a22, Default a23, Default a24, Default a25, Default a26, Default a27, Default a28, Default a29, Default a30) => Default (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30)

Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30) #

(Default a1, Default a2, Default a3, Default a4, Default a5, Default a6, Default a7, Default a8, Default a9, Default a10, Default a11, Default a12, Default a13, Default a14, Default a15, Default a16, Default a17, Default a18, Default a19, Default a20, Default a21, Default a22, Default a23, Default a24, Default a25, Default a26, Default a27, Default a28, Default a29, Default a30, Default a31) => Default (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, a31)

Instance details Defined in Data.Default.Internal Methods def :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, a31) #

quantile Source #

Arguments

:: Vector v Double |
=> ContParam | Parameters α and β.
-> Int | k, the desired quantile.
-> Int | q, the number of quantiles.
-> v Double | x, the sample data.
-> Double |

O(n·log n). Estimate the kth q-quantile of a sample x, using the continuous sample method with the given parameters.

The following properties should hold, otherwise an error will be thrown.

- input sample must be nonempty
- the input does not contain `NaN`
- 0 ≤ k ≤ q

quantiles :: (Vector v Double, Foldable f, Functor f) => ContParam -> f Int -> Int -> v Double -> f Double Source #

O(k·n·log n). Estimate set of the kth q-quantile of a sample x, using the continuous sample method with the given parameters. This is faster than calling quantile repeatedly since sample should be sorted only once

The following properties should hold, otherwise an error will be thrown.

- input sample must be nonempty
- the input does not contain `NaN`
- for every k in set of quantiles 0 ≤ k ≤ q

quantilesVec :: (Vector v Double, Vector v Int) => ContParam -> v Int -> Int -> v Double -> v Double Source #

O(k·n·log n). Same as quantiles but uses `Vector` container instead of `Foldable` one.

## Parameters for the continuous sample method

cadpw :: ContParam Source #

California Department of Public Works definition, α=0, β=1. Gives a linear interpolation of the empirical CDF. This corresponds to method 4 in R and Mathematica.

hazen :: ContParam Source #

Hazen's definition, α=0.5, β=0.5. This is claimed to be popular among hydrologists. This corresponds to method 5 in R and Mathematica.

spss :: ContParam Source #

Definition used by the SPSS statistics application, with α=0, β=0 (also known as Weibull's definition). This corresponds to method 6 in R and Mathematica.

s :: ContParam Source #

Definition used by the S statistics application, with α=1, β=1. The interpolation points divide the sample range into `n-1` intervals. This corresponds to method 7 in R and Mathematica and is default in R.

medianUnbiased :: ContParam Source #

Median unbiased definition, α=1/3, β=1/3. The resulting quantile estimates are approximately median unbiased regardless of the distribution of x. This corresponds to method 8 in R and Mathematica.

normalUnbiased :: ContParam Source #

Normal unbiased definition, α=3/8, β=3/8. An approximately unbiased estimate if the empirical distribution approximates the normal distribution. This corresponds to method 9 in R and Mathematica.

# Other algorithms

weightedAvg Source #

Arguments

:: Vector v Double |
=> Int | k, the desired quantile.
-> Int | q, the number of quantiles.
-> v Double | x, the sample data.
-> Double |

O(n·log n). Estimate the kth q-quantile of a sample, using the weighted average method. Up to rounding errors it's same as `quantile s`.

The following properties should hold otherwise an error will be thrown.

- the length of the input is greater than `0`
- the input does not contain `NaN`
- k ≥ 0 and k ≤ q

# Median & other specializations

median Source #

Arguments

:: Vector v Double |
=> ContParam | Parameters α and β.
-> v Double | x, the sample data.
-> Double |

O(n·log n) Estimate median of sample

mad Source #

Arguments

:: Vector v Double |
=> ContParam | Parameters α and β.
-> v Double | x, the sample data.
-> Double |

O(n·log n). Estimate the median absolute deviation (MAD) of a sample x using `continuousBy`. It's robust estimate of variability in sample and defined as:

\[ MAD = \operatorname{median}(| X_i - \operatorname{median}(X) |) \]

midspread Source #

Arguments

:: Vector v Double |
=> ContParam | Parameters α and β.
-> Int | q, the number of quantiles.
-> v Double | x, the sample data.
-> Double |

O(n·log n). Estimate the range between q-quantiles 1 and q-1 of a sample x, using the continuous sample method with the given parameters.

For instance, the interquartile range (IQR) can be estimated as follows:

    midspread medianUnbiased 4 (U.fromList [1,1,2,2,3])
    ==> 1.333333

# Deprecated

continuousBy Source #

Arguments

:: Vector v Double |
=> ContParam | Parameters α and β.
-> Int | k, the desired quantile.
-> Int | q, the number of quantiles.
-> v Double | x, the sample data.
-> Double |

Deprecated: Use quantile instead

# References

- Weisstein, E.W. Quantile. MathWorld. http://mathworld.wolfram.com/Quantile.html
- [Hyndman1996] Hyndman, R.J.; Fan, Y. (1996) Sample quantiles in statistical packages. American Statistician 50(4):361–365. http://www.jstor.org/stable/2684934