statistics-0.16.5.0: A library of statistical types, data, and functions
Copyright(c) Praneya Kumar Alexey Khudyakov 2025
LicenseBSD-3-Clause
Safe HaskellNone
LanguageHaskell2010

Statistics.Test.Bartlett

Description

Bartlett's test is used to check that multiple groups of observations come from distributions with equal variances. This test assumes that samples come from normal distribution. If this is not the case it may simple test for non-normality and Levene's (Statistics.Test.Levene) is preferred

>>> import qualified Data.Vector.Unboxed as VU
>>> import Statistics.Test.Bartlett
>>> :{
let a = VU.fromList [8.88, 9.12, 9.04, 8.98, 9.00, 9.08, 9.01, 8.85, 9.06, 8.99]
    b = VU.fromList [8.88, 8.95, 9.29, 9.44, 9.15, 9.58, 8.36, 9.18, 8.67, 9.05]
    c = VU.fromList [8.95, 9.12, 8.95, 8.85, 9.03, 8.84, 9.07, 8.98, 8.86, 8.98]
in bartlettTest [a,b,c]
:}
Right (Test {testSignificance = mkPValue 1.1254782518843598e-5, testStatistics = 22.789434813726768, testDistribution = chiSquared 2})
Synopsis

Documentation

bartlettTest :: Vector v Double => [v Double] -> Either String (Test ChiSquared) Source #

Perform Bartlett's test for equal variances. The input is a list of vectors, where each vector represents a group of observations.

data ChiSquared Source #

Chi-squared distribution

Instances

Instances details
FromJSON ChiSquared Source # 
Instance details

Defined in Statistics.Distribution.ChiSquared

Methods

parseJSON :: Value -> Parser ChiSquared

parseJSONList :: Value -> Parser [ChiSquared]

omittedField :: Maybe ChiSquared

ToJSON ChiSquared Source # 
Instance details

Defined in Statistics.Distribution.ChiSquared

Methods

toJSON :: ChiSquared -> Value

toEncoding :: ChiSquared -> Encoding

toJSONList :: [ChiSquared] -> Value

toEncodingList :: [ChiSquared] -> Encoding

omitField :: ChiSquared -> Bool

Binary ChiSquared Source # 
Instance details

Defined in Statistics.Distribution.ChiSquared

Methods

put :: ChiSquared -> Put

get :: Get ChiSquared

putList :: [ChiSquared] -> Put

Data ChiSquared Source # 
Instance details

Defined in Statistics.Distribution.ChiSquared

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ChiSquared -> c ChiSquared

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ChiSquared

toConstr :: ChiSquared -> Constr

dataTypeOf :: ChiSquared -> DataType

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ChiSquared)

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

gmapT :: (forall b. Data b => b -> b) -> ChiSquared -> ChiSquared

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ChiSquared -> r

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ChiSquared -> r

gmapQ :: (forall d. Data d => d -> u) -> ChiSquared -> [u]

gmapQi :: Int -> (forall d. Data d => d -> u) -> ChiSquared -> u

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ChiSquared -> m ChiSquared

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ChiSquared -> m ChiSquared

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ChiSquared -> m ChiSquared

Generic ChiSquared Source # 
Instance details

Defined in Statistics.Distribution.ChiSquared

Associated Types

type Rep ChiSquared 
Instance details

Defined in Statistics.Distribution.ChiSquared

type Rep ChiSquared = D1 ('MetaData "ChiSquared" "Statistics.Distribution.ChiSquared" "statistics-0.16.5.0-CUpwRr22xOC5RMvoidvha8" 'True) (C1 ('MetaCons "ChiSquared" 'PrefixI 'True) (S1 ('MetaSel ('Just "chiSquaredNDF") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))

Methods

from :: ChiSquared -> Rep ChiSquared x

to :: Rep ChiSquared x -> ChiSquared

Read ChiSquared Source # 
Instance details

Defined in Statistics.Distribution.ChiSquared

Methods

readsPrec :: Int -> ReadS ChiSquared

readList :: ReadS [ChiSquared]

readPrec :: ReadPrec ChiSquared

readListPrec :: ReadPrec [ChiSquared]

Show ChiSquared Source # 
Instance details

Defined in Statistics.Distribution.ChiSquared

Methods

showsPrec :: Int -> ChiSquared -> ShowS

show :: ChiSquared -> String

showList :: [ChiSquared] -> ShowS

Eq ChiSquared Source # 
Instance details

Defined in Statistics.Distribution.ChiSquared

Methods

(==) :: ChiSquared -> ChiSquared -> Bool

(/=) :: ChiSquared -> ChiSquared -> Bool

ContDistr ChiSquared Source # 
Instance details

Defined in Statistics.Distribution.ChiSquared

Methods

density :: ChiSquared -> Double -> Double Source #

logDensity :: ChiSquared -> Double -> Double Source #

quantile :: ChiSquared -> Double -> Double Source #

complQuantile :: ChiSquared -> Double -> Double Source #

ContGen ChiSquared Source # 
Instance details

Defined in Statistics.Distribution.ChiSquared

Methods

genContVar :: StatefulGen g m => ChiSquared -> g -> m Double Source #

Distribution ChiSquared Source # 
Instance details

Defined in Statistics.Distribution.ChiSquared

Methods

cumulative :: ChiSquared -> Double -> Double Source #

complCumulative :: ChiSquared -> Double -> Double Source #

Entropy ChiSquared Source # 
Instance details

Defined in Statistics.Distribution.ChiSquared

Methods

entropy :: ChiSquared -> Double Source #

MaybeEntropy ChiSquared Source # 
Instance details

Defined in Statistics.Distribution.ChiSquared

Methods

maybeEntropy :: ChiSquared -> Maybe Double Source #

MaybeMean ChiSquared Source # 
Instance details

Defined in Statistics.Distribution.ChiSquared

Methods

maybeMean :: ChiSquared -> Maybe Double Source #

MaybeVariance ChiSquared Source # 
Instance details

Defined in Statistics.Distribution.ChiSquared

Methods

maybeVariance :: ChiSquared -> Maybe Double Source #

maybeStdDev :: ChiSquared -> Maybe Double Source #

Mean ChiSquared Source # 
Instance details

Defined in Statistics.Distribution.ChiSquared

Methods

mean :: ChiSquared -> Double Source #

Variance ChiSquared Source # 
Instance details

Defined in Statistics.Distribution.ChiSquared

Methods

variance :: ChiSquared -> Double Source #

stdDev :: ChiSquared -> Double Source #

type Rep ChiSquared Source # 
Instance details

Defined in Statistics.Distribution.ChiSquared

type Rep ChiSquared = D1 ('MetaData "ChiSquared" "Statistics.Distribution.ChiSquared" "statistics-0.16.5.0-CUpwRr22xOC5RMvoidvha8" 'True) (C1 ('MetaCons "ChiSquared" 'PrefixI 'True) (S1 ('MetaSel ('Just "chiSquaredNDF") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))

chiSquared :: Int -> ChiSquared Source #

Construct chi-squared distribution. Number of degrees of freedom must be positive.