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

Copyright | (c) Praneya Kumar Alexey Khudyakov 2025
License | BSD-3-Clause
Safe Haskell | None
Language | Haskell2010

Statistics.Test.Levene

Description

Levene's test used to check whether samples have equal variance. Null hypothesis is all samples are from distributions with same variance (homoscedacity). Test is robust to non-normality, and versatile with mean or median centering.

    >>> import qualified Data.Vector.Unboxed as VU
    >>> import Statistics.Test.Levene
    >>> :{
    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 levenesTest Median [a, b, c]
    :}
    Right (Test {testSignificance = mkPValue 2.4315059672496814e-3, testStatistics = 7.584952754501659, testDistribution = fDistributionReal 2.0 27.0})

Synopsis

- data Center
  - = Mean
  - | Median
  - | Trimmed !Double
- levenesTest :: Vector v Double => Center -> [v Double] -> Either String (Test FDistribution)

# Documentation

data Center Source #

Center calculation method

Constructors

Mean | Use arithmetic mean
Median | Use median
Trimmed !Double | Trimmed mean with given proportion to cut from each end

#### Instances

Instances details

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

levenesTest Source #

Arguments

:: Vector v Double |
=> Center | Centering method
-> [v Double] | Input samples
-> Either String (Test FDistribution) |

Main Levene's test function with full error handling