The OpenD Programming Language

ksTest

One-sample Kolmogorov-Smirnov test against a reference distribution. Takes a callable object for the CDF of refernce distribution.

  1. TestRes ksTest(T F, U Fprime)
  2. TestRes ksTest(T Femp, Func F)
    ksTest
    (
    T
    Func
    )
    (,
    Func F
    )
    if (
    doubleInput!(T) &&
    is(ReturnType!(Func) : double)
    )

Return Value

Type: TestRes

A TestRes with the Kolmogorov-Smirnov D value and a P value for the null that Femp is a sample from F against the alternative that it isn't. This implementation uses a signed D value to indicate the direction of the difference between distributions. To get the D value used in standard notation, simply take the absolute value of this D value.

Bugs

Exact calculation not implemented. Uses asymptotic approximation.

Examples

auto stdNormal = parametrize!(normalCDF)(0.0, 1.0);
auto empirical = [1, 2, 3, 4, 5];
auto res = ksTest(empirical, stdNormal);

References: http://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Smirnov_test

Meta