public class KS
extends java.lang.Object
WH Press, SA Teukolsky, WT Vetterling and BPFlannery. Numerical Recipes in C: The art of Scientific Computing 2ed. New York: Cambridge University Press, 1992, pp 623--628.
The KS variation employed here is due to Kuiper (see Numerical Recipes for reference). This variation guarantess an equal sensitivity to variations throughout the distribution, where as the tradition KS statistic loses sensitivity towards the tails.
Modifier and Type | Field and Description |
---|---|
static double |
MIN_SUM_DELTA
The minimum fraction of the sum that a term can be before we'll say the sum has converged.
|
static double |
MIN_TERM_DELTA
The minimum fraction of the previous term a term can be before we'll say the sum has converged.
|
Constructor and Description |
---|
KS() |
Modifier and Type | Method and Description |
---|---|
static double |
computeOneSampleKS(int[] data,
CDF func)
Computes the Kuiper's statistic on own data set given a CDF distribution (see Numerical Recipes in C); assumes the dataset is
sorted.
|
static double |
computeTwoSampleKS(int[] data1,
int[] data2)
Computes the Kuiper's statistic on the two data sets (see Numerical Recipes in C); assumes the datasets are sorted.
|
static CDF |
getUniformCDF(double min,
double max)
Returns a uniform CDF.
|
static double |
probKS(double lambda)
Computes the probability of seeing lambda given the asymptotic distribution of distribution of the V statistic.
|
public static final double MIN_SUM_DELTA
public static final double MIN_TERM_DELTA
public static double computeOneSampleKS(int[] data, CDF func)
V = D+ + D- = max[S(x) - CDF(x)] + max[CDF(x) - S(x)]Where S is the unbiased estimator of the data and CDF is the given cumulative disribution function. V is then passed to
probKS(lambda)
where
lambda = [k + 0.155 + 0.24/k] * Vand
k = sqrt(length1 * length2 / (length1 + length2))and length1 and length2 are the number of data points in data1 and data2.
CDF
,
probKS(double)
public static double computeTwoSampleKS(int[] data1, int[] data2)
V = D+ + D- = max[S1(x) - S2(x)] + max[S2(x) - S1(x)]Where S1 and S2 are the unbiased estimators of data1 and data2.
probKS(lambda)
where
lambda = [k + 0.155 + 0.24/k] * Vand
k = sqrt(length1 * length2 / (length1 + length2))and length1 and length2 are the number of data points in data1 and data2.
probKS(double)
public static CDF getUniformCDF(double min, double max)
public static double probKS(double lambda)
computeOneSampleKS(int[], CDF)
or
computeTwoSampleKS(int[], int[])
.