Statistics.Test.KolmogorovSmirnov

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

Copyright | (c) 2011 Aleksey Khudyakov
License | BSD3
Maintainer | bos@serpentine.com
Stability | experimental
Portability | portable
Safe Haskell | None
Language | Haskell2010

Statistics.Test.KolmogorovSmirnov

Contents

- Kolmogorov-Smirnov test
- Evaluate statistics
- Probabilities
- References

Description

Kolmogov-Smirnov tests are non-parametric tests for assessing whether given sample could be described by distribution or whether two samples have the same distribution. It's only applicable to continuous distributions.

Synopsis

- kolmogorovSmirnovTest :: (Distribution d, Vector v Double) => d -> v Double -> Maybe (Test ())
- kolmogorovSmirnovTestCdf :: Vector v Double => (Double -> Double) -> v Double -> Maybe (Test ())
- kolmogorovSmirnovTest2 :: Vector v Double => v Double -> v Double -> Maybe (Test ())
- kolmogorovSmirnovCdfD :: Vector v Double => (Double -> Double) -> v Double -> Double
- kolmogorovSmirnovD :: (Distribution d, Vector v Double) => d -> v Double -> Double
- kolmogorovSmirnov2D :: Vector v Double => v Double -> v Double -> Double
- kolmogorovSmirnovProbability :: Int -> Double -> Double
- module Statistics.Test.Types

# Kolmogorov-Smirnov test

kolmogorovSmirnovTest #

Arguments

:: (Distribution d, Vector v Double) |
=> d | Distribution
-> v Double | Data sample
-> Maybe (Test ()) |

Check that sample could be described by distribution. Returns `Nothing` is sample is empty

This test uses Marsaglia-Tsang-Wang exact algorithm for calculation of p-value.

kolmogorovSmirnovTestCdf #

Arguments

:: Vector v Double |
=> (Double -> Double) | CDF of distribution
-> v Double | Data sample
-> Maybe (Test ()) |

Variant of `kolmogorovSmirnovTest` which uses CDF in form of function.

kolmogorovSmirnovTest2 #

Arguments

:: Vector v Double |
=> v Double | Sample 1
-> v Double | Sample 2
-> Maybe (Test ()) |

Two sample Kolmogorov-Smirnov test. It tests whether two data samples could be described by the same distribution without making any assumptions about it. If either of samples is empty returns Nothing.

This test uses approximate formula for computing p-value.

# Evaluate statistics

kolmogorovSmirnovCdfD #

Arguments

:: Vector v Double |
=> (Double -> Double) | CDF function
-> v Double | Sample
-> Double |

Calculate Kolmogorov's statistic D for given cumulative distribution function (CDF) and data sample. If sample is empty returns 0.

kolmogorovSmirnovD #

Arguments

:: (Distribution d, Vector v Double) |
=> d | Distribution
-> v Double | Sample
-> Double |

Calculate Kolmogorov's statistic D for given cumulative distribution function (CDF) and data sample. If sample is empty returns 0.

kolmogorovSmirnov2D #

Arguments

:: Vector v Double |
=> v Double | First sample
-> v Double | Second sample
-> Double |

Calculate Kolmogorov's statistic D for two data samples. If either of samples is empty returns 0.

# Probabilities

kolmogorovSmirnovProbability #

Arguments

:: Int | Size of the sample
-> Double | D value
-> Double |

Calculate cumulative probability function for Kolmogorov's distribution with n parameters or probability of getting value smaller than d with n-elements sample.

It uses algorithm by Marsgalia et. al. and provide at least 7-digit accuracy.

# References

- G. Marsaglia, W. W. Tsang, J. Wang (2003) Evaluating Kolmogorov's distribution, Journal of Statistical Software, American Statistical Association, vol. 8(i18).

module Statistics.Test.Types