Record Class KSTest
- Record Components:
method
- the type of test.d
- the Kolmogorov-Smirnov statistic.pvalue
- the p-value.
The two-sample KS test is one of the most useful and general non-parametric methods for comparing two samples, as it is sensitive to differences in both location and shape of the empirical cumulative distribution functions of the two samples.
The Kolmogorov-Smirnov test can be modified to serve goodness of fit test. In the special case of testing for normality of the distribution, samples are standardized and compared with a standard normal distribution. This is equivalent to setting the mean and variance of the reference distribution equal to the sample estimates, and it is known that using the sample to modify the null hypothesis reduces the power of a test. Correcting for this bias leads to the Lilliefors test. However, even Lilliefors' modification is less powerful than the Shapiro-Wilk test or Anderson-Darling test for testing normality.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
d()
Returns the value of thed
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.method()
Returns the value of themethod
record component.double
pvalue()
Returns the value of thepvalue
record component.static KSTest
test
(double[] x, double[] y) The two-sample KS test for the null hypothesis that the data sets are drawn from the same distribution.static KSTest
test
(double[] x, Distribution dist) The one-sample KS test for the null hypothesis that the data set x is drawn from the given distribution.toString()
Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
test
The one-sample KS test for the null hypothesis that the data set x is drawn from the given distribution. Small values of p-value show that the cumulative distribution function of x is significantly different from the given distribution. The array x is modified by being sorted into ascending order.- Parameters:
x
- the sample values.dist
- the distribution.- Returns:
- the test results.
-
test
The two-sample KS test for the null hypothesis that the data sets are drawn from the same distribution. Small values of p-value show that the cumulative distribution function of x is significantly different from that of y. The arrays x and y are modified by being sorted into ascending order.- Parameters:
x
- the sample values.y
- the sample values.- Returns:
- the test results.
-
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
method
Returns the value of themethod
record component.- Returns:
- the value of the
method
record component
-
d
public double d()Returns the value of thed
record component.- Returns:
- the value of the
d
record component
-
pvalue
public double pvalue()Returns the value of thepvalue
record component.- Returns:
- the value of the
pvalue
record component
-