public class KolmogorovOneSample extends Object implements Serializable
KolmogorovOneSample
performs a KolmogorovSmirnov
goodnessoffit test in one sample.
The hypotheses tested follow:
where is the cumulative distribution function (CDF) of the random variable, and the theoretical cdf, , is specified via the usersupplied function cdf. Let n be the number of observations minus the number of missing observations. The test statistics for both onesided alternatives and and the twosided alternative are computed as well as an asymptotic zscore and pvalues associated with the onesided and twosided hypotheses. For , asymptotic pvalues are used (see Gibbons 1971). For , exact onesided pvalues are computed according to a method given by Conover (1980, page 350). An approximate twosided test pvalue is obtained as twice the onesided pvalue. The approximation is very close for onesided pvalues less than 0.10 and becomes very bad as the onesided pvalues get larger.The theoretical CDF is assumed to be continuous. If the CDF is not continuous, the statistics will not be computed correctly.
Estimation of parameters in the theoretical CDF from the sample data will tend to make the pvalues associated with the test statistics too liberal. The empirical CDF will tend to be closer to the theoretical CDF than it should be.
No attempt is made to check that all points in the sample are in the support of the theoretical CDF. If all sample points are not in the support of the CDF, the null hypothesis must be rejected.
Constructor and Description 

KolmogorovOneSample(CdfFunction cdf,
double[] x)
Constructs a one sample KolmogorovSmirnov goodnessoffit test.

Modifier and Type  Method and Description 

double 
getMaximumDifference()
Returns ,
the maximum difference between the theoretical and empirical CDF's.

double 
getMinimumDifference()
Returns ,
the minimum difference between the theoretical and empirical CDF's.

int 
getNumberMissing()
Returns the number of missing values in the data.

int 
getNumberOfTies()
Returns the number of ties in the data.

double 
getOneSidedPValue()
Probability of the statistic exceeding D under
the null hypothesis of equality and against the
onesided alternative.

double 
getTestStatistic()
Returns .

double 
getTwoSidedPValue()
Probability of the statistic exceeding D under
the null hypothesis of equality and against the
twosided alternative.

double 
getZ()
Returns the normalized D statistic without the continuity correction applied.

public KolmogorovOneSample(CdfFunction cdf, double[] x)
cdf
 is the cdf function, .
If must be nondecreasing and its value must be in [0, 1].x
 is a double
array containing the observations.public double getMaximumDifference()
public double getMinimumDifference()
public int getNumberMissing()
public int getNumberOfTies()
public double getOneSidedPValue()
public double getTestStatistic()
public double getTwoSidedPValue()
getOneSidedPValue
,
(or 1.0 if ).
This approximation is nearly exact when
.public double getZ()
Copyright © 19702015 Rogue Wave Software
Built October 13 2015.