ksTest - multiple declarations

Function ksTest

Performs a Kolmogorov-Smirnov (K-S) 2-sample test. The K-S test is a non-parametric test for a difference between two empirical distributions or between an empirical distribution and a reference distribution.

TestRes ksTest(T, U) (
  T F,
  U Fprime
)
if (doubleInput!T && doubleInput!U);

Returns

A TestRes with the K-S D value and a P value for the null that FPrime is distributed identically to 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.

References

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

Function ksTest

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

TestRes ksTest(T, Func) (
  T Femp,
  Func F
)
if (doubleInput!T && is(ReturnType!Func : double));

Returns

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